Files
MSE-PI-E2EEDA-Plein-de-eeee…/report/main/database/design.typ

48 lines
2.6 KiB
Typst

#import "/metadata.typ": *
Only natural stupidity was used to for the design of this part. But some key design are reused from an hobby project developed in parallel of the current one. The database part actually represent a aggregation of all small part all running around database on the cloud. We will talk more about the server part in the @sec:impl:db.
The database part have several missions. To achieves all objectives, a GO service is designed in several module.
Before see the service itself, a little talk on the stack. For the database, we choose Influx DB 3. Mainly because it's a time-series database already known by part of the team. Another option would be to use a PostgreSQL database with the timescale extension. Concerning the @mqtt broker, we choose RabbitMQ for mainly the same reason, because it's already known by part of the team.
The key design in the Go service is to represent data with a DataPoint. A DataPoint represent a measure with a list of topics, a timestamp and a generic type for the value. It allows to share DataPoints trough gateway that have the same input and output interface. Event the database part is developed in Go, a pseudo class diagram in @fig:class-db represent this DataPoint shared between gateways.
#pagebreak()
So, we need an @mqtt gateway to connect to the broker to get updates of sensors. To achieves to connect to this broker, a module @mqtt is represented as mqttGateway in the @fig:class-db. This @mqtt gateway is mainly used to subscribe to the desire topic and receive a DataPoint defined previously
#figure(
image("class-db.png"),
caption: [Class diagram for database part]
) <fig:class-db>
We also need a influx gateway to push this received DataPoint to the database. It's the magic of the DataPoint, no need to map each field. We only translate topic, from node id to room and we can forward the DataPoint to the Influx gateway. We see the full sequence from the broker to the database in the @fig:seq:toDB
Finally, we also have a rest gateway to allow user to request data from the database trough with several endpoint as defined in @sec:design:interface:db. Mostly use by the user interface. We can observe a general application in @fig:seq:fromDB.
#let fig-toDB = [
#import "sequence.typ": *
#figure(
chronos.diagram(toDB, width: 100%),
caption: [Sequence from broker to DB]
) <fig:seq:toDB>
]
#let fig-fromDB = [
#import "sequence.typ": *
#figure(
chronos.diagram(fromDB, width: 100%),
caption: [Sequence to REST from DB]
) <fig:seq:fromDB>
]
#grid(
columns: (1fr, 1fr),
column-gutter: 1em,
align: bottom+center,
fig-toDB,
fig-fromDB
)
#pagebreak()