pub trait ReadableStore: Map {
    // Required methods
    fn blobs(&self) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>;
    fn tags(
        &self
    ) -> Box<dyn Iterator<Item = (Tag, HashAndFormat)> + Send + Sync + 'static>;
    fn temp_tags(
        &self
    ) -> Box<dyn Iterator<Item = HashAndFormat> + Send + Sync + 'static>;
    fn validate(
        &self,
        tx: Sender<ValidateProgress>
    ) -> BoxFuture<'_, Result<()>>;
    fn partial_blobs(
        &self
    ) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>;
    fn export(
        &self,
        hash: Hash,
        target: PathBuf,
        mode: ExportMode,
        progress: impl Fn(u64) -> Result<()> + Send + Sync + 'static
    ) -> BoxFuture<'_, Result<()>>;
}
Expand description

Extension of BaoMap to add misc methods used by the rpc calls.

Required Methods§

source

fn blobs(&self) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>

list all blobs in the database. This should include collections, since collections are blobs and can be requested as blobs.

This function should not block to perform io. The knowledge about existing blobs must be present in memory.

source

fn tags( &self ) -> Box<dyn Iterator<Item = (Tag, HashAndFormat)> + Send + Sync + 'static>

list all tags (collections or other explicitly added things) in the database

This function should not block to perform io. The knowledge about existing tags must be present in memory.

source

fn temp_tags( &self ) -> Box<dyn Iterator<Item = HashAndFormat> + Send + Sync + 'static>

Temp tags

source

fn validate(&self, tx: Sender<ValidateProgress>) -> BoxFuture<'_, Result<()>>

Validate the database

source

fn partial_blobs( &self ) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>

list partial blobs in the database

source

fn export( &self, hash: Hash, target: PathBuf, mode: ExportMode, progress: impl Fn(u64) -> Result<()> + Send + Sync + 'static ) -> BoxFuture<'_, Result<()>>

This trait method extracts a file to a local path.

hash is the hash of the file target is the path to the target file mode is a hint how the file should be exported. progress is a callback that is called with the total number of bytes that have been written

Object Safety§

This trait is not object safe.

Implementors§

source§

impl ReadableStore for iroh_bytes::store::flat::Store

source§

impl ReadableStore for iroh_bytes::store::mem::Store

source§

impl ReadableStore for iroh_bytes::store::readonly_mem::Store