You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We need a way to allow users to persist outgoing MQTT packets to a non-volatile storage space, in case of network loss for longer periods. Ideally this should be a full opt-in feature.
Basic idea would be to make it two steps.
Persistent buffering to external flash
Work in progress i am thinking something along the lines of a key-value store, highly inspired by the persistence layer in Paho:
use embedded_storage::ReadWriteStorage;pubenumPersistenceError{}pubstructKey();pubtraitMqttPerisistence:ReadWriteStorage{typePacket:MqttPayload;/// Initialize the persistent store.////// Either open the existing persistent store for this client ID or create a new/// one if one doesn't exist. If the persistent store is already open, return /// without taking any action.////// An application can use the same client identifier to connect to many/// different servers. The clientid in conjunction with the /// server_uri uniquely identifies the persistence store required.fnopen(&mutself) -> Result<(),PersistenceError>;/// Close the persistent store referred to by the handle.fnclose(&mutself) -> Result<(),PersistenceError>;/// Put the specified data into the persistent store.fnput(&mutself,key:Key,data:Self::Packet) -> Result<(),PersistenceError>;/// Retrieve the specified data from the persistent store.fnget(&mutself,key:Key) -> Result<Self::Packet,PersistenceError>;/// Remove the data for the specified key from the storefnremove(&mutself,key:Key) -> Result<(),PersistenceError>;/// Returns the keys in this persistent data store.fnkeys(&mutself) -> implIter<Key>;/// Clears the persistence store, so that it no longer contains any persisted data.fnclear(&mutself) -> Result<(),PersistenceError>;/// Returns whether any data has been persisted using the specified key.fncontains(&mutself,key:Key) -> bool;/// A callback which is invoked just before a write to persistence. This can be/// used to transform the data, for instance to encrypt it.fnbefore_write(&mutself,key) -> Result<(),PersistenceError>{};/// A callback which is invoked just after a read from persistence. This can be/// used to transform the data, for instance to decrypt it.fnafter_read(&mutself) -> Result<(),PersistenceError>{};}
The text was updated successfully, but these errors were encountered:
Motivation
We need a way to allow users to persist outgoing MQTT packets to a non-volatile storage space, in case of network loss for longer periods. Ideally this should be a full opt-in feature.
Basic idea would be to make it two steps.
Persistent buffering to external flash
Work in progress i am thinking something along the lines of a key-value store, highly inspired by the persistence layer in Paho:
The text was updated successfully, but these errors were encountered: