Trait rust_ipfs::repo::DataStore

source ·
pub trait DataStore: PinStore + Debug + Send + Sync + 'static {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn open<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn contains<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8]
    ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8]
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn put<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8],
        value: &'life2 [u8]
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 [u8]
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn iter<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = BoxStream<'static, (Vec<u8>, Vec<u8>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn wipe<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Generic layer of abstraction for a key-value data store.

Required Methods§

source

fn init<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn open<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

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

Checks if a key is present in the datastore.

source

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

Returns the value associated with a key from the datastore.

source

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

Puts the value under the key in the datastore.

source

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

Removes a key-value pair from the datastore.

source

fn iter<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = BoxStream<'static, (Vec<u8>, Vec<u8>)>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Iterate over the k/v of the datastore

Provided Methods§

source

fn wipe<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Wipes the datastore.

Implementors§

source§

impl DataStore for FsDataStore

The column operations are all unimplemented pending at least downscoping of the DataStore trait itself.

source§

impl DataStore for MemDataStore

source§

impl DataStore for SledDataStore