Trait iroh_bytes::store::Map

source ·
pub trait Map: Clone + Send + Sync + 'static {
    type Outboard: Outboard;
    type DataReader: AsyncSliceReader;
    type Entry: MapEntry<Self>;

    // Required method
    fn get(&self, hash: &Hash) -> Option<Self::Entry>;
}
Expand description

A generic collection of blobs with precomputed outboards

Required Associated Types§

source

type Outboard: Outboard

The outboard type. This can be an in memory outboard or an outboard that retrieves the data asynchronously from a remote database.

source

type DataReader: AsyncSliceReader

The reader type.

source

type Entry: MapEntry<Self>

The entry type. An entry is a cheaply cloneable handle that can be used to open readers for both the data and the outboard

Required Methods§

source

fn get(&self, hash: &Hash) -> Option<Self::Entry>

Get an entry for a hash.

This can also be used for a membership test by just checking if there is an entry. Creating an entry should be cheap, any expensive ops should be deferred to the creation of the actual readers.

It is not guaranteed that the entry is complete. A PartialMap would return here both complete and partial entries, so that you can share partial entries.

This function should not block to perform io. The knowledge about existing entries must be present in memory.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Map for iroh_bytes::store::flat::Store

source§

impl Map for iroh_bytes::store::mem::Store

source§

impl Map for iroh_bytes::store::readonly_mem::Store