Trait iroh_blobs::store::MapMut

source ·
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§

source

type EntryMut: MapEntryMut

An entry that is possibly writable

Required Methods§

source

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.

source

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.

source

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.

source

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.

source

fn insert_complete( &self, entry: Self::EntryMut ) -> impl Future<Output = Result<()>> + Send

Upgrade a partial entry to a complete entry.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl MapMut for iroh_blobs::store::fs::Store

§

type EntryMut = BaoFileHandle

source§

impl MapMut for iroh_blobs::store::mem::Store

source§

impl MapMut for iroh_blobs::store::readonly_mem::Store