[][src]Trait ipfs_embed_core::Store

pub trait Store: Clone + Send + Sync {
    type Params: StoreParams;
#[must_use]    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cid: &'life1 Cid
    ) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>, Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn commit<'life0, 'async_trait>(
        &'life0 self,
        tx: Transaction<Self::Params>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; #[must_use] fn insert<'life0, 'async_trait>(
        &'life0 self,
        block: Block<Self::Params>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        Self: 'async_trait,
        Ipld: Decode<<Self::Params as StoreParams>::Codecs>
, { ... }
#[must_use] fn unpin<'life0, 'life1, 'async_trait>(
        &'life0 self,
        cid: &'life1 Cid
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn query<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        path: &'life1 DagPath<'life2>
    ) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        Self: 'async_trait,
        Ipld: Decode<<Self::Params as StoreParams>::Codecs>
, { ... }
#[must_use] fn sync<'life0, 'async_trait>(
        &'life0 self,
        old: Option<Cid>,
        new: Cid
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        Self: 'async_trait,
        Ipld: Decode<<Self::Params as StoreParams>::Codecs>
, { ... }
#[must_use] fn flush<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } }

Implementable by ipld stores.

Associated Types

type Params: StoreParams

Store parameters.

Loading content...

Required methods

#[must_use]fn get<'life0, 'life1, 'async_trait>(
    &'life0 self,
    cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>, Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Returns a block from the store. If the store supports networking and the block is not in the store it fetches it from the network. Dropping the future cancels the request. This will not insert the block into the store.

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

#[must_use]fn commit<'life0, 'async_trait>(
    &'life0 self,
    tx: Transaction<Self::Params>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Commits a transaction to the store.

Loading content...

Provided methods

#[must_use]fn insert<'life0, 'async_trait>(
    &'life0 self,
    block: Block<Self::Params>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    Self: 'async_trait,
    Ipld: Decode<<Self::Params as StoreParams>::Codecs>, 

Inserts a block into the store.

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

Unpins a block from the store.

#[must_use]fn query<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    path: &'life1 DagPath<'life2>
) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait,
    Ipld: Decode<<Self::Params as StoreParams>::Codecs>, 

Resolves a path recursively and returns the ipld.

#[must_use]fn sync<'life0, 'async_trait>(
    &'life0 self,
    old: Option<Cid>,
    new: Cid
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send>> where
    'life0: 'async_trait,
    Self: 'async_trait,
    Ipld: Decode<<Self::Params as StoreParams>::Codecs>, 

Recursively gets a block and all it's references, inserts them into the store, pins the root and unpins the old root.

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

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

Flushes the write buffer.

Loading content...

Implementations on Foreign Types

impl<S> Store for MemStore<S> where
    S: StoreParams,
    Ipld: Decode<<S as StoreParams>::Codecs>, 
[src]

type Params = S

Loading content...

Implementors

Loading content...