[−][src]Trait ipfs_embed_core::Store
Implementable by ipld stores. An ipld store behaves like a cache. It will keep blocks until the cache is full after which it evicts blocks based on an eviction policy. If a block is aliased (recursive named pin), it and it's recursive references will not be evicted or counted towards the cache size.
Associated Types
type Params: StoreParams
[src]
Store parameters.
Required methods
#[must_use]pub fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>, Error>> + 'async_trait + Send, Global>> 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 and inserts it into the store. Dropping the future cancels the request.
If the block wasn't found it returns a BlockNotFound
error.
#[must_use]pub fn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
block: &'life1 Block<Self::Params>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
block: &'life1 Block<Self::Params>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Inserts a block into the store and publishes the block on the network.
#[must_use]pub fn alias<'life0, 'life1, 'async_trait, T>(
&'life0 self,
alias: T,
cid: Option<&'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
[src]
&'life0 self,
alias: T,
cid: Option<&'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
Creates an alias for a Cid
. To alias a block all it's recursive references
must be in the store. If blocks are missing, they will be fetched from the network. If
they aren't found, it will return a BlockNotFound
error.
#[must_use]pub fn resolve<'life0, 'async_trait, T>(
&'life0 self,
alias: T
) -> Pin<Box<dyn Future<Output = Result<Option<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
[src]
&'life0 self,
alias: T
) -> Pin<Box<dyn Future<Output = Result<Option<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
Resolves an alias for a Cid
.
Provided methods
#[must_use]pub fn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 DagPath<'life2>
) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Ipld: Decode<<Self::Params as StoreParams>::Codecs>,
[src]
&'life0 self,
path: &'life1 DagPath<'life2>
) -> Pin<Box<dyn Future<Output = Result<Ipld, Error>> + 'async_trait + Send, Global>> 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.
Implementations on Foreign Types
impl<S> Store for MemStore<S> where
S: StoreParams,
Ipld: References<<S as StoreParams>::Codecs>,
[src]
S: StoreParams,
Ipld: References<<S as StoreParams>::Codecs>,
type Params = S
pub fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Pin<Box<dyn Future<Output = Result<Block<S>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
MemStore<S>: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>
) -> Pin<Box<dyn Future<Output = Result<Block<S>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
MemStore<S>: 'async_trait,
pub fn insert<'life0, 'life1, 'async_trait>(
&'life0 self,
block: &'life1 Block<S>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
MemStore<S>: 'async_trait,
[src]
&'life0 self,
block: &'life1 Block<S>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
MemStore<S>: 'async_trait,
pub fn alias<'life0, 'life1, 'async_trait, T>(
&'life0 self,
alias: T,
cid: Option<&'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
MemStore<S>: 'async_trait,
[src]
&'life0 self,
alias: T,
cid: Option<&'life1 Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
MemStore<S>: 'async_trait,
pub fn resolve<'life0, 'async_trait, T>(
&'life0 self,
alias: T
) -> Pin<Box<dyn Future<Output = Result<Option<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
MemStore<S>: 'async_trait,
[src]
&'life0 self,
alias: T
) -> Pin<Box<dyn Future<Output = Result<Option<Cid<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>>>, Error>> + 'async_trait + Send, Global>> where
'life0: 'async_trait,
T: AsRef<[u8]> + Send + Sync + 'async_trait,
MemStore<S>: 'async_trait,