Skip to content

Protobuf Libraries to encode/decode messages in Drift infrastructure

License

Notifications You must be signed in to change notification settings

panda-official/DriftProtocol

Repository files navigation

Drift Protocol

The Drift Protocol is a set of libraries that use Protocol Buffers (Protobuf) to encode messages in the PANDA|Drift infrastructure. The libraries provide pre-generated Protobuf messages so that users do not have to install the protobuf compiler and generate them themselves.

Implementations

Example

The Drift Protocol can be used to create microservice applications. An example of such an application is shown in the accompanying diagram:

Drift Protocol Example

The Trigger service publishes a trigger as a Drift Package with ID = 1630062869443 and a Trigger Interval Message, which contains a time interval [t0, t1], to the trigger MQTT topic.

The Timeswipe service subscribes to the trigger topic and receives a trigger package. Then it retrieves data of 48000 samples per second from a vibration sensor for the interval [t0, t1] by using a Time Swipe device, compresses, serializes the data and sends it to MQTT topic drift/sensor as a Drift Package with a Data Payload inside. It contains a serialized Wavelet Buffer in the data field. The ID of the packages is the same ID=1630062869443, so we see that the trigger and the data are connected.

The Drift Core services subscribe to all MQTT topics which have drift/ prefix, parse Drift Packages and stores them in the metric and blob storages. After that, you can use Drift Python Client to request data from the storage.

Why Protobuf?

We use Protobuf to encode messages in Drift Protocol because it is a very efficient and flexible serialization format, especially for binary data. It is also very easy to use and has a lot of implementations for different programming languages.

Related Projects