[][src]Trait ipfs_embed::WritableStore

pub trait WritableStore: ReadonlyStore {
    fn insert(
        &'a self,
        block: &'a Block<Self::Codec, Self::Multihash>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a + Send>>;
fn insert_batch(
        &'a self,
        batch: &'a [Block<Self::Codec, Self::Multihash>]
    ) -> Pin<Box<dyn Future<Output = Result<Cid, Error>> + 'a + Send>>;
fn flush(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn unpin(
        &'a self,
        cid: &'a Cid
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a + Send>>; }

Implementable by ipld storage backends.

Required methods

fn insert(
    &'a self,
    block: &'a Block<Self::Codec, Self::Multihash>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a + Send>>

Inserts and pins block into the store and announces it if it is visible.

If the block is larger than MAX_BLOCK_SIZE it returns a BlockTooLarge error.

fn insert_batch(
    &'a self,
    batch: &'a [Block<Self::Codec, Self::Multihash>]
) -> Pin<Box<dyn Future<Output = Result<Cid, Error>> + 'a + Send>>

Inserts a batch of blocks atomically into the store and announces them block if it is visible. The last block is pinned.

If the block is larger than MAX_BLOCK_SIZE it returns a BlockTooLarge error. If the batch is empty it returns an EmptyBatch error.

fn flush(&self) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>

Flushes the write buffer.

fn unpin(
    &'a self,
    cid: &'a Cid
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'a + Send>>

Decreases the ref count on a cid.

Loading content...

Implementations on Foreign Types

impl<C, M> Store for MemStore<C, M> where
    C: Codec,
    M: MultihashDigest, 
[src]

Loading content...

Implementors

impl<C: Codec, M: MultihashDigest> Store for Store<C, M>[src]

Loading content...