Skip to content

Latest commit

 

History

History

store-and-forward

store-and-forward

The store-and-forward container runs a GRPC server that takes messages in from the sensor containers (sense-go, sense-python), stores them in a BoltDB database, and forwards them to the REST API on the controller.

store-and-forward is also a central location for storing the current value of any variable that is used for automatic environment control. sense-go container queries store-and-forward for those values when making control decisions.

GRPC was chosen as the container-to-container communications system for its speed and its go-centricity.

The messaging protocol is defined in the .proto file. The Go code that is actually compiled into the system is generated by running the generateProto scripts. I do this manually as needed as the protocol only changes very rarely.

The GRPC messages envelope standard BubblesNet JSON messages, described here.

The BoltDB database can become hopelessly backlogged if it is disconnected from the controller REST API for too long (24 hours?). When NODE_ENV is set to development, the BoltDB is cleared on every container restart. In production, we never lose data.