Trait forest_filecoin::utils::db::CborStoreExt

source ·
pub trait CborStoreExt: CborStore {
    // Provided methods
    fn default_code() -> Code { ... }
    fn put_cbor_default<S: Serialize>(&self, obj: &S) -> Result<Cid> { ... }
    fn get_cbor_required<T>(&self, cid: &Cid) -> Result<T>
       where T: DeserializeOwned { ... }
}
Expand description

Extension methods for CborStore that omits default multihash code from its APIs

Provided Methods§

source

fn default_code() -> Code

Default multihash code is cid::multihash::Code::Blake2b256 See https://github.com/ipfs/go-ipld-cbor/blob/v0.0.6/store.go#L92

mhType := uint64(mh.BLAKE2B_MIN + 31)
// 45569 + 31 = 45600 = 0xb220
source

fn put_cbor_default<S: Serialize>(&self, obj: &S) -> Result<Cid>

A wrapper of CborStore::put_cbor that omits code parameter to match store API in go

source

fn get_cbor_required<T>(&self, cid: &Cid) -> Result<T>

Get typed object from block store by CID. Return an error when not found.

Object Safety§

This trait is not object safe.

Implementors§