[][src]Trait ipfs_embed::ReadonlyStore

pub trait ReadonlyStore: Clone + Send + Sync {
    type Multihash: MultihashDigest;
    type Codec: Codec;

    const MAX_BLOCK_SIZE: usize;

    fn get(
        &'a self,
        cid: Cid
    ) -> Pin<Box<dyn Future<Output = Result<Block<Self::Codec, Self::Multihash>, Error>> + 'a + Send>>; fn get_ipld(
        &'a self,
        cid: &'a Cid
    ) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'a + Send>> { ... }
fn get_path(
        &'a self,
        path: &'a DagPath<'a>
    ) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'a + Send>> { ... } }

Implementable by ipld storage providers.

Associated Types

type Multihash: MultihashDigest

The multihash type of the store.

type Codec: Codec

The codec type of the store.

Loading content...

Associated Constants

const MAX_BLOCK_SIZE: usize

The maximum block size supported by the store.

Loading content...

Required methods

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

Returns a block from the store. If the block is not in the store it fetches it from the network and pins the block. Dropping the future cancels the request.

If the block wasn't found it returns a BlockNotFound error.

Loading content...

Provided methods

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

Returns the ipld representation of a block with cid.

fn get_path(
    &'a self,
    path: &'a DagPath<'a>
) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'a + Send>>

Resolves a path recursively and returns the ipld.

Loading content...

Implementations on Foreign Types

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

type Codec = C

type Multihash = M

Loading content...

Implementors

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

type Codec = C

type Multihash = M

Loading content...