Trait iroh_blobs::store::MapEntry
source · pub trait MapEntry: Debug + Clone + Send + Sync + 'static {
// Required methods
fn hash(&self) -> Hash;
fn size(&self) -> BaoBlobSize;
fn is_complete(&self) -> bool;
fn outboard(&self) -> impl Future<Output = Result<impl Outboard>> + Send;
fn data_reader(
&self
) -> impl Future<Output = Result<impl AsyncSliceReader>> + Send;
// Provided method
fn write_verifiable_stream<'a>(
&'a self,
offset: u64,
writer: impl AsyncStreamWriter + 'a
) -> impl Future<Output = Result<()>> + 'a { ... }
}
Expand description
An entry for one hash in a bao map
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 size(&self) -> BaoBlobSize
fn size(&self) -> BaoBlobSize
The size of the entry.
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 was marked as complete in the store.
sourcefn outboard(&self) -> impl Future<Output = Result<impl Outboard>> + Send
fn outboard(&self) -> impl Future<Output = Result<impl Outboard>> + Send
A future that resolves to a reader that can be used to read the outboard
sourcefn data_reader(
&self
) -> impl Future<Output = Result<impl AsyncSliceReader>> + Send
fn data_reader( &self ) -> impl Future<Output = Result<impl AsyncSliceReader>> + Send
A future that resolves to a reader that can be used to read the data
Provided Methods§
sourcefn write_verifiable_stream<'a>(
&'a self,
offset: u64,
writer: impl AsyncStreamWriter + 'a
) -> impl Future<Output = Result<()>> + 'a
fn write_verifiable_stream<'a>( &'a self, offset: u64, writer: impl AsyncStreamWriter + 'a ) -> impl Future<Output = Result<()>> + 'a
Encodes data and outboard into a [AsyncStreamWriter
].
Data and outboard parts will be interleaved.
offset
is the byte offset in the blob to start the stream from. It will be rounded down to
the next chunk group.
Returns immediately without error if start
is equal or larger than the entry’s size.