Skip to main content

BlockStorage

Trait BlockStorage 

Source
pub trait BlockStorage: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cid: &'life1 Cid<64>,
    ) -> Pin<Box<dyn Future<Output = Result<Block, StorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn set<'life0, 'async_trait>(
        &'life0 self,
        block: Block,
    ) -> Pin<Box<dyn Future<Output = Result<Cid<64>, StorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn remove<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cid: &'life1 Cid<64>,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn max_block_size(&self) -> usize;

    // Provided method
    fn stat<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cid: &'life1 Cid<64>,
    ) -> Pin<Box<dyn Future<Output = Result<BlockStat, StorageError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid<64>, ) -> Pin<Box<dyn Future<Output = Result<Block, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns a block from storage.

Source

fn set<'life0, 'async_trait>( &'life0 self, block: Block, ) -> Pin<Box<dyn Future<Output = Result<Cid<64>, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Inserts a block into storage.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid<64>, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Remove a block.

Source

fn max_block_size(&self) -> usize

Maximum accepted block size.

Provided Methods§

Source

fn stat<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid<64>, ) -> Pin<Box<dyn Future<Output = Result<BlockStat, StorageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Stat a block.

Implementors§