pub trait MapMut: Map {
type EntryMut: MapEntryMut;
// Required methods
fn get_mut(
&self,
hash: &Hash,
) -> impl Future<Output = Result<Option<Self::EntryMut>>> + Send;
fn get_or_create(
&self,
hash: Hash,
size: u64,
) -> impl Future<Output = Result<Self::EntryMut>> + Send;
fn entry_status(
&self,
hash: &Hash,
) -> impl Future<Output = Result<EntryStatus>> + Send;
fn entry_status_sync(&self, hash: &Hash) -> Result<EntryStatus>;
fn insert_complete(
&self,
entry: Self::EntryMut,
) -> impl Future<Output = Result<()>> + Send;
}
Expand description
A mutable bao map.
This extends the readonly Map
trait with methods to create and modify entries.
Required Associated Types§
Sourcetype EntryMut: MapEntryMut
type EntryMut: MapEntryMut
An entry that is possibly writable
Required Methods§
Sourcefn get_mut(
&self,
hash: &Hash,
) -> impl Future<Output = Result<Option<Self::EntryMut>>> + Send
fn get_mut( &self, hash: &Hash, ) -> impl Future<Output = Result<Option<Self::EntryMut>>> + Send
Get an existing entry as an EntryMut.
For implementations where EntryMut and Entry are the same type, this is just an alias for
get
.
Sourcefn get_or_create(
&self,
hash: Hash,
size: u64,
) -> impl Future<Output = Result<Self::EntryMut>> + Send
fn get_or_create( &self, hash: Hash, size: u64, ) -> impl Future<Output = Result<Self::EntryMut>> + Send
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,
) -> impl Future<Output = Result<EntryStatus>> + Send
fn entry_status( &self, hash: &Hash, ) -> impl Future<Output = Result<EntryStatus>> + Send
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 entry_status_sync(&self, hash: &Hash) -> Result<EntryStatus>
fn entry_status_sync(&self, hash: &Hash) -> Result<EntryStatus>
Sync version of entry_status
, for the doc sync engine until we can get rid of it.
Don’t count on this to be efficient.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.