Storage

Trait Storage 

Source
pub trait Storage:
    Clone
    + ConditionalSync
    + Debug {
    type BlockStore: BlockStore;
    type KeyValueStore: KeyValueStore;

    // Required methods
    fn get_block_store<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Self::BlockStore>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_key_value_store<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Self::KeyValueStore>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Storage is a general trait for composite storage backends. It is often the case that we are able to use a single storage primitive for all forms of storage, but sometimes block storage and generic key/value storage come from different backends. Storage provides a composite interface where both cases well accomodated without creating complexity in the signatures of other Noosphere constructs.

Required Associated Types§

Required Methods§

Source

fn get_block_store<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Self::BlockStore>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a BlockStore where all values stored in it are scoped to the given name

Source

fn get_key_value_store<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Self::KeyValueStore>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a KeyValueStore where all values stored in it are scoped to the given name

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§