Struct iroh_bytes::store::mem::Store

source ·
pub struct Store(/* private fields */);
Expand description

A full in memory database for iroh-bytes.

Implementations§

source§

impl Store

source

pub fn new(rt: Handle) -> Self

Create a new in memory database, using the given runtime.

Trait Implementations§

source§

impl Clone for Store

source§

fn clone(&self) -> Store

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Store

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Map for Store

§

type Outboard = PreOrderOutboard<MemFile>

The outboard type. This can be an in memory outboard or an outboard that retrieves the data asynchronously from a remote database.
§

type DataReader = MemFile

The reader type.
§

type Entry = Entry

The entry type. An entry is a cheaply cloneable handle that can be used to open readers for both the data and the outboard
source§

fn get(&self, hash: &Hash) -> Option<Self::Entry>

Get an entry for a hash. Read more
source§

fn contains(&self, hash: &Hash) -> EntryStatus

Find out if the data behind a hash is complete, partial, or not present. Read more
source§

impl MapEntry<Store> for Entry

source§

fn hash(&self) -> Hash

The hash of the entry.
source§

fn available_ranges(&self) -> BoxFuture<'_, Result<ChunkRanges>>

Compute the available ranges. Read more
source§

fn size(&self) -> u64

The size of the entry.
source§

fn outboard(&self) -> BoxFuture<'_, Result<PreOrderOutboard<MemFile>>>

A future that resolves to a reader that can be used to read the outboard
source§

fn data_reader(&self) -> BoxFuture<'_, Result<MemFile>>

A future that resolves to a reader that can be used to read the data
source§

fn is_complete(&self) -> bool

Returns true if the entry is complete. Read more
source§

impl MapEntry<Store> for PartialEntry

source§

fn hash(&self) -> Hash

The hash of the entry.
source§

fn available_ranges(&self) -> BoxFuture<'_, Result<ChunkRanges>>

Compute the available ranges. Read more
source§

fn size(&self) -> u64

The size of the entry.
source§

fn outboard(&self) -> BoxFuture<'_, Result<PreOrderOutboard<MemFile>>>

A future that resolves to a reader that can be used to read the outboard
source§

fn data_reader(&self) -> BoxFuture<'_, Result<MemFile>>

A future that resolves to a reader that can be used to read the data
source§

fn is_complete(&self) -> bool

Returns true if the entry is complete. Read more
source§

impl PartialMap for Store

§

type OutboardMut = PreOrderOutboard<MutableMemFile>

The outboard type to write data to the partial entry.
§

type DataWriter = MutableMemFile

The writer type to write data to the partial entry.
§

type PartialEntry = PartialEntry

A partial entry. This is an entry that is writeable and possibly incomplete. Read more
source§

fn get_partial(&self, hash: &Hash) -> Option<PartialEntry>

Get an existing partial entry. Read more
source§

fn get_or_create_partial(&self, hash: Hash, size: u64) -> Result<PartialEntry>

Get an existing partial entry, or create a new one. Read more
source§

fn insert_complete(&self, entry: PartialEntry) -> BoxFuture<'_, Result<()>>

Upgrade a partial entry to a complete entry.
source§

impl PartialMapEntry<Store> for PartialEntry

source§

fn outboard_mut( &self ) -> BoxFuture<'_, Result<PreOrderOutboard<MutableMemFile>>>

A future that resolves to an writeable outboard
source§

fn data_writer(&self) -> BoxFuture<'_, Result<MutableMemFile>>

A future that resolves to a writer that can be used to write the data
source§

impl ReadableStore for Store

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. Read more
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 Read more
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. Read more
source§

impl Store for Store

source§

fn import_file( &self, path: PathBuf, _mode: ImportMode, format: BlobFormat, progress: impl ProgressSender<Msg = ImportProgress> + IdGenerator ) -> BoxFuture<'_, Result<(TempTag, u64)>>

This trait method imports a file from a local path. Read more
source§

fn import_stream( &self, data: impl Stream<Item = Result<Bytes>> + Unpin + Send + 'static, format: BlobFormat, progress: impl ProgressSender<Msg = ImportProgress> + IdGenerator ) -> BoxFuture<'_, Result<(TempTag, u64)>>

Import data from a stream of bytes.
source§

fn import_bytes( &self, bytes: Bytes, format: BlobFormat ) -> BoxFuture<'_, Result<TempTag>>

Import data from memory. Read more
source§

fn set_tag( &self, name: Tag, value: Option<HashAndFormat> ) -> BoxFuture<'_, Result<()>>

Set a tag
source§

fn create_tag(&self, hash: HashAndFormat) -> BoxFuture<'_, Result<Tag>>

Create a new tag
source§

fn temp_tag(&self, tag: HashAndFormat) -> TempTag

Create a temporary pin for this store
source§

fn clear_live(&self)

Clear the live set.
source§

fn add_live(&self, live: impl IntoIterator<Item = Hash>)

Add the given hashes to the live set. Read more
source§

fn is_live(&self, hash: &Hash) -> bool

True if the given hash is live.
source§

fn delete(&self, hash: &Hash) -> BoxFuture<'_, Result<()>>

physically delete the given hash from the store.
source§

fn import_reader( &self, data: impl AsyncRead + Send + Unpin + 'static, format: BlobFormat, progress: impl ProgressSender<Msg = ImportProgress> + IdGenerator ) -> BoxFuture<'_, Result<(TempTag, u64)>>

Import data from an async byte reader.
source§

fn gc_mark<'a>( &'a self, extra_roots: impl IntoIterator<Item = Result<HashAndFormat>> + 'a ) -> LocalBoxStream<'a, GcMarkEvent>

Traverse all roots recursively and mark them as live. Read more
source§

fn gc_sweep(&self) -> LocalBoxStream<'_, GcSweepEvent>

Remove all blobs that are not marked as live. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl !UnwindSafe for Store

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more