[][src]Trait ipld_blockstore::BlockStore

pub trait BlockStore: Store {
    pub fn get_bytes(
        &self,
        cid: &Cid
    ) -> Result<Option<Vec<u8>>, Box<dyn StdError>> { ... }
pub fn get<T>(&self, cid: &Cid) -> Result<Option<T>, Box<dyn StdError>>
    where
        T: DeserializeOwned
, { ... }
pub fn put<S>(&self, obj: &S, code: Code) -> Result<Cid, Box<dyn StdError>>
    where
        S: Serialize
, { ... }
pub fn put_raw(
        &self,
        bytes: Vec<u8>,
        code: Code
    ) -> Result<Cid, Box<dyn StdError>> { ... }
pub fn bulk_put<'a, S, V>(
        &self,
        values: V,
        code: Code
    ) -> Result<Vec<Cid>, Box<dyn StdError>>
    where
        S: Serialize + 'a,
        V: IntoIterator<Item = &'a S>
, { ... } }

Wrapper for database to handle inserting and retrieving ipld data with Cids

Provided methods

pub fn get_bytes(&self, cid: &Cid) -> Result<Option<Vec<u8>>, Box<dyn StdError>>[src]

Get bytes from block store by Cid.

pub fn get<T>(&self, cid: &Cid) -> Result<Option<T>, Box<dyn StdError>> where
    T: DeserializeOwned
[src]

Get typed object from block store by Cid.

pub fn put<S>(&self, obj: &S, code: Code) -> Result<Cid, Box<dyn StdError>> where
    S: Serialize
[src]

Put an object in the block store and return the Cid identifier.

pub fn put_raw(
    &self,
    bytes: Vec<u8>,
    code: Code
) -> Result<Cid, Box<dyn StdError>>
[src]

Put raw bytes in the block store and return the Cid identifier.

pub fn bulk_put<'a, S, V>(
    &self,
    values: V,
    code: Code
) -> Result<Vec<Cid>, Box<dyn StdError>> where
    S: Serialize + 'a,
    V: IntoIterator<Item = &'a S>, 
[src]

Batch put cbor objects into blockstore and returns vector of Cids

Loading content...

Implementations on Foreign Types

impl BlockStore for MemoryDB[src]

Loading content...

Implementors

Loading content...