Trait iroh_bytes::store::MapEntry
source · 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§
sourcefn is_complete(&self) -> bool
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.
sourcefn available_ranges(&self) -> BoxFuture<'_, Result<ChunkRanges>>
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.
sourcefn outboard(&self) -> BoxFuture<'_, Result<D::Outboard>>
fn outboard(&self) -> BoxFuture<'_, Result<D::Outboard>>
A future that resolves to a reader that can be used to read the outboard
sourcefn data_reader(&self) -> BoxFuture<'_, Result<D::DataReader>>
fn data_reader(&self) -> BoxFuture<'_, Result<D::DataReader>>
A future that resolves to a reader that can be used to read the data