Trait libp2p_bitswap::BitswapStore
source · pub trait BitswapStore: Send + Sync + 'static {
type Params: StoreParams;
// Required methods
fn contains(&mut self, cid: &Cid) -> Result<bool>;
fn get(&mut self, cid: &Cid) -> Result<Option<Vec<u8>>>;
fn insert(&mut self, block: &Block<Self::Params>) -> Result<()>;
fn missing_blocks(&mut self, cid: &Cid) -> Result<Vec<Cid>>;
}
Expand description
Trait implemented by a block store.
Required Associated Types§
sourcetype Params: StoreParams
type Params: StoreParams
The store params.
Required Methods§
sourcefn contains(&mut self, cid: &Cid) -> Result<bool>
fn contains(&mut self, cid: &Cid) -> Result<bool>
A have query needs to know if the block store contains the block.
sourcefn get(&mut self, cid: &Cid) -> Result<Option<Vec<u8>>>
fn get(&mut self, cid: &Cid) -> Result<Option<Vec<u8>>>
A block query needs to retrieve the block from the store.
sourcefn insert(&mut self, block: &Block<Self::Params>) -> Result<()>
fn insert(&mut self, block: &Block<Self::Params>) -> Result<()>
A block response needs to insert the block into the store.
sourcefn missing_blocks(&mut self, cid: &Cid) -> Result<Vec<Cid>>
fn missing_blocks(&mut self, cid: &Cid) -> Result<Vec<Cid>>
A sync query needs a list of missing blocks to make progress.