Trait libipld::store::Store [−][src]
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
Loading content...Required methods
fn create_temp_pin(&self) -> Result<Self::TempPin>
[src]
Creates a new temporary pin.
fn temp_pin(&self, tmp: &Self::TempPin, cid: &Cid) -> Result<()>
[src]
Adds a block to a temp pin.
fn contains(&self, cid: &Cid) -> Result<bool>
[src]
Returns true if the store contains the block.
fn get(&self, cid: &Cid) -> Result<Block<Self::Params>>
[src]
Returns a block from the store. If the block wasn't found it returns a BlockNotFound
error.
fn insert(&self, block: &Block<Self::Params>) -> Result<()>
[src]
Inserts a block into the store and publishes the block on the network.
fn alias<T: AsRef<[u8]> + Send + Sync>(
&self,
alias: T,
cid: Option<&Cid>
) -> Result<()>
[src]
&self,
alias: T,
cid: Option<&Cid>
) -> Result<()>
Creates an alias for a Cid
.
fn resolve<T: AsRef<[u8]> + Send + Sync>(&self, alias: T) -> Result<Option<Cid>>
[src]
Resolves an alias for a Cid
.
fn reverse_alias(&self, cid: &Cid) -> Result<Option<Vec<Vec<u8>>>>
[src]
Returns all the aliases that are keeping the block around.
#[must_use]fn flush<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Flushes the store.
#[must_use]fn fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<Block<Self::Params>>> + Send + 'async_trait>> 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]fn sync<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Fetches all missing blocks recursively from the network. If a block isn't found it
returns a BlockNotFound
error.
Provided methods
#[must_use]fn query<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
path: &'life1 DagPath<'life2>
) -> Pin<Box<dyn Future<Output = Result<Ipld>> + Send + 'async_trait>> where
Ipld: Decode<<Self::Params as StoreParams>::Codecs>,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
path: &'life1 DagPath<'life2>
) -> Pin<Box<dyn Future<Output = Result<Ipld>> + Send + 'async_trait>> where
Ipld: Decode<<Self::Params as StoreParams>::Codecs>,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
Resolves a path recursively and returns the ipld.
Implementors
impl<S: StoreParams> Store for MemStore<S> where
Ipld: References<S::Codecs>,
[src]
Ipld: References<S::Codecs>,
type Params = S
type TempPin = TempPin
fn create_temp_pin(&self) -> Result<Self::TempPin>
[src]
fn temp_pin(&self, tmp: &Self::TempPin, cid: &Cid) -> Result<()>
[src]
fn contains(&self, cid: &Cid) -> Result<bool>
[src]
fn get(&self, cid: &Cid) -> Result<Block<S>>
[src]
fn insert(&self, block: &Block<S>) -> Result<()>
[src]
fn alias<T: AsRef<[u8]> + Send + Sync>(
&self,
alias: T,
cid: Option<&Cid>
) -> Result<()>
[src]
&self,
alias: T,
cid: Option<&Cid>
) -> Result<()>
fn resolve<T: AsRef<[u8]> + Send + Sync>(&self, alias: T) -> Result<Option<Cid>>
[src]
fn reverse_alias(&self, cid: &Cid) -> Result<Option<Vec<Vec<u8>>>>
[src]
fn fetch<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<Block<S>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<Block<S>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn sync<'life0, 'life1, 'async_trait>(
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
cid: &'life1 Cid
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,