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 get_partial(&self, hash: &Hash) -> Option<Self::PartialEntry>;
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 get_partial(&self, hash: &Hash) -> Option<Self::PartialEntry>
fn get_partial(&self, hash: &Hash) -> Option<Self::PartialEntry>
Get an existing partial entry.
This will return None if there is no partial entry for this hash.
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.
Object Safety§
This trait is not object safe.