pub trait MapEntry<D: Map>: Clone + Send + Sync + 'static {
    // Required methods
    fn hash(&self) -> Hash;
    fn size(&self) -> u64;
    fn is_complete(&self) -> bool;
    fn available_ranges(&self) -> BoxFuture<'_, Result<ChunkRanges>>;
    fn outboard(&self) -> BoxFuture<'_, Result<D::Outboard>>;
    fn data_reader(&self) -> BoxFuture<'_, Result<D::DataReader>>;
}
Expand description

An entry for one hash in a bao collection

The entry has the ability to provide you with an (outboard, data) reader pair. Creating the reader is async and may fail. The futures that create the readers must be Send, but the readers themselves don’t have to be.

Required Methods§

source

fn hash(&self) -> Hash

The hash of the entry.

source

fn size(&self) -> u64

The size of the entry.

source

fn is_complete(&self) -> bool

Returns true if the entry is complete.

Note that this does not actually verify if the bytes on disk are complete, it only checks if the entry is among the partial or complete section of the Map. To verify if all bytes are actually available on disk, use MapEntry::available_ranges.

source

fn available_ranges(&self) -> BoxFuture<'_, Result<ChunkRanges>>

Compute the available ranges.

Depending on the implementation, this may be an expensive operation.

It can also only ever be a best effort, since the underlying data may change at any time. E.g. somebody could flip a bit in the file, or download more chunks.

source

fn outboard(&self) -> BoxFuture<'_, Result<D::Outboard>>

A future that resolves to a reader that can be used to read the outboard

source

fn data_reader(&self) -> BoxFuture<'_, Result<D::DataReader>>

A future that resolves to a reader that can be used to read the data

Object Safety§

This trait is not object safe.

Implementors§

source§

impl MapEntry<Store> for iroh_bytes::store::flat::Entry

source§

impl MapEntry<Store> for iroh_bytes::store::flat::PartialEntry

source§

impl MapEntry<Store> for iroh_bytes::store::mem::Entry

source§

impl MapEntry<Store> for iroh_bytes::store::mem::PartialEntry

source§

impl MapEntry<Store> for iroh_bytes::store::readonly_mem::PartialEntry

source§

impl MapEntry<Store> for iroh_bytes::store::readonly_mem::Entry