iroh_blobs::store

Trait 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.

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.

Implementors§

Source§

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

Available on crate feature fs-store only.
Source§

type EntryMut = BaoFileHandle

Source§

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

Source§

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