Store

Trait Store 

Source
pub trait Store: Send + Sync {
    // Required methods
    fn set<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
        value: Arc<[u8]>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<[u8]>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn contains_key<'life0, 'async_trait>(
        &'life0 self,
        scope: Arc<[u8]>,
        key: Arc<[u8]>,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Set of method for basic storage providers to implement.

Required Methods§

Source

fn set<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, value: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set a key-value pair, if the key already exist, value should be overwritten

Source

fn get<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<[u8]>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get a value for specified key, it should result in None if the value does not exist

Source

fn delete<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete the key from storage, if the key doesn’t exist, it shouldn’t return an error

Source

fn contains_key<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if key exist in storage

Implementations on Foreign Types§

Source§

impl<T> Store for Addr<T>

Source§

fn set<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, value: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn delete<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn contains_key<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get<'life0, 'async_trait>( &'life0 self, scope: Arc<[u8]>, key: Arc<[u8]>, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<[u8]>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§