Trait iroh_bytes::store::ReadableStore
source · 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§
sourcefn blobs(&self) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>
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.
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.
Temp tags
sourcefn validate(&self, tx: Sender<ValidateProgress>) -> BoxFuture<'_, Result<()>>
fn validate(&self, tx: Sender<ValidateProgress>) -> BoxFuture<'_, Result<()>>
Validate the database
sourcefn partial_blobs(
&self
) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>
fn partial_blobs( &self ) -> Box<dyn Iterator<Item = Hash> + Send + Sync + 'static>
list partial blobs in the database
sourcefn export(
&self,
hash: Hash,
target: PathBuf,
mode: ExportMode,
progress: impl Fn(u64) -> Result<()> + Send + Sync + 'static
) -> BoxFuture<'_, Result<()>>
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