Trait iroh_blobs::store::Map

source ·
pub trait Map: Clone + Send + Sync + 'static {
    type Entry: MapEntry;

    // Required method
    fn get(
        &self,
        hash: &Hash
    ) -> impl Future<Output = Result<Option<Self::Entry>>> + Send;
}
Expand description

A generic map from hashes to bao blobs (blobs with bao outboards).

This is the readonly view. To allow updates, a concrete implementation must also implement MapMut.

Entries are not guaranteed to be complete for all implementations. They are also not guaranteed to be immutable, since this could be the readonly view of a mutable store.

Required Associated Types§

source

type Entry: MapEntry

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 ) -> impl Future<Output = Result<Option<Self::Entry>>> + Send

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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl Map for iroh_blobs::store::fs::Store

§

type Entry = BaoFileHandle

source§

impl Map for iroh_blobs::store::mem::Store

§

type Entry = Entry

source§

impl Map for iroh_blobs::store::readonly_mem::Store

§

type Entry = Entry