Trait zenoh_backend_traits::Storage

source ·
pub trait Storage: Send + Sync {
    // Required methods
    fn get_admin_status(&self) -> Value;
    fn put<'life0, 'async_trait>(
        &'life0 mut self,
        key: Option<OwnedKeyExpr>,
        value: Value,
        timestamp: Timestamp,
    ) -> Pin<Box<dyn Future<Output = ZResult<StorageInsertionResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 mut self,
        key: Option<OwnedKeyExpr>,
        timestamp: Timestamp,
    ) -> Pin<Box<dyn Future<Output = ZResult<StorageInsertionResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        key: Option<OwnedKeyExpr>,
        parameters: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ZResult<Vec<StoredData>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_all_entries<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ZResult<Vec<(Option<OwnedKeyExpr>, Timestamp)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait to be implemented by a Storage.

Required Methods§

source

fn get_admin_status(&self) -> Value

Returns the status that will be sent as a reply to a query on the administration space for this storage.

source

fn put<'life0, 'async_trait>( &'life0 mut self, key: Option<OwnedKeyExpr>, value: Value, timestamp: Timestamp, ) -> Pin<Box<dyn Future<Output = ZResult<StorageInsertionResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Function called for each incoming data (Sample) to be stored in this storage. A key can be None if it matches the strip_prefix exactly. In order to avoid data loss, the storage must store the value and timestamp associated with the None key in a manner suitable for the given backend technology

source

fn delete<'life0, 'async_trait>( &'life0 mut self, key: Option<OwnedKeyExpr>, timestamp: Timestamp, ) -> Pin<Box<dyn Future<Output = ZResult<StorageInsertionResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Function called for each incoming delete request to this storage. A key can be None if it matches the strip_prefix exactly. In order to avoid data loss, the storage must delete the entry corresponding to the None key in a manner suitable for the given backend technology

source

fn get<'life0, 'life1, 'async_trait>( &'life0 mut self, key: Option<OwnedKeyExpr>, parameters: &'life1 str, ) -> Pin<Box<dyn Future<Output = ZResult<Vec<StoredData>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Function to retrieve the sample associated with a single key. A key can be None if it matches the strip_prefix exactly. In order to avoid data loss, the storage must retrieve the value and timestamp associated with the None key in a manner suitable for the given backend technology

source

fn get_all_entries<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ZResult<Vec<(Option<OwnedKeyExpr>, Timestamp)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Function called to get the list of all storage content (key, timestamp) The latest Timestamp corresponding to each key is either the timestamp of the delete or put whichever is the latest. Remember to fetch the entry corresponding to the None key

Implementors§