Trait iroh_bytes::store::PartialMap
source · pub trait PartialMap: Map {
type OutboardMut: OutboardMut;
type DataWriter: AsyncSliceWriter;
type PartialEntry: PartialMapEntry<Self>;
// Required methods
fn get_or_create_partial(
&self,
hash: Hash,
size: u64
) -> Result<Self::PartialEntry>;
fn entry_status(&self, hash: &Hash) -> EntryStatus;
fn get_possibly_partial(&self, hash: &Hash) -> PossiblyPartialEntry<Self>;
fn insert_complete(
&self,
entry: Self::PartialEntry
) -> BoxFuture<'_, Result<()>>;
}Expand description
A mutable bao map
Required Associated Types§
sourcetype OutboardMut: OutboardMut
type OutboardMut: OutboardMut
The outboard type to write data to the partial entry.
sourcetype DataWriter: AsyncSliceWriter
type DataWriter: AsyncSliceWriter
The writer type to write data to the partial entry.
sourcetype PartialEntry: PartialMapEntry<Self>
type PartialEntry: PartialMapEntry<Self>
A partial entry. This is an entry that is writeable and possibly incomplete.
It must also be readable.
Required Methods§
sourcefn get_or_create_partial(
&self,
hash: Hash,
size: u64
) -> Result<Self::PartialEntry>
fn get_or_create_partial( &self, hash: Hash, size: u64 ) -> Result<Self::PartialEntry>
Get an existing partial entry, or create a new one.
We need to know the size of the partial entry. This might produce an error e.g. if there is not enough space on disk.
sourcefn entry_status(&self, hash: &Hash) -> EntryStatus
fn entry_status(&self, hash: &Hash) -> EntryStatus
Find out if the data behind a hash is complete, partial, or not present.
Note that this does not actually verify the on-disc data, but only checks in which section of the store the entry is present.
sourcefn get_possibly_partial(&self, hash: &Hash) -> PossiblyPartialEntry<Self>
fn get_possibly_partial(&self, hash: &Hash) -> PossiblyPartialEntry<Self>
Get an existing entry.
This will return either a complete entry, a partial entry, or not found.
This function should not block to perform io. The knowledge about partial entries must be present in memory.
sourcefn insert_complete(
&self,
entry: Self::PartialEntry
) -> BoxFuture<'_, Result<()>>
fn insert_complete( &self, entry: Self::PartialEntry ) -> BoxFuture<'_, Result<()>>
Upgrade a partial entry to a complete entry.