Trait Cache

Source
pub trait Cache<C, T>: ReadonlyCache<C, T>
where C: Decoder + Encoder + Clone + Send + Sync, T: Decode<<C as Decoder>::Codec> + Encode<<C as Encoder>::Codec> + Clone + Send + Sync,
{ // Required methods fn create_batch(&self) -> CacheBatch<C, T>; fn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>; fn insert_batch<'life0, 'async_trait>( &'life0 self, batch: CacheBatch<C, T>, ) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn insert<'life0, 'async_trait>( &'life0 self, value: T, ) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn unpin<'life0, 'life1, 'async_trait>( &'life0 self, cid: &'life1 Cid, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; }
Expand description

Cache trait.

Required Methods§

Source

fn create_batch(&self) -> CacheBatch<C, T>

Creates a typed batch.

Source

fn create_batch_with_capacity(&self, capacity: usize) -> CacheBatch<C, T>

Creates a typed batch.

Source

fn insert_batch<'life0, 'async_trait>( &'life0 self, batch: CacheBatch<C, T>, ) -> Pin<Box<dyn Future<Output = Result<Cid>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Inserts a batch into the store.

Source

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

Encodes and inserts a block.

Source

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

Flushes all buffers.

Source

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

Unpins a block.

Implementors§

Source§

impl<S: Store + Send + Sync, C, T> Cache<C, T> for IpldCache<S, C, T>
where C: Decoder + Encoder + Clone + Send + Sync, T: Decode<<C as Decoder>::Codec> + Encode<<C as Encoder>::Codec> + Clone + Send + Sync,