Struct zarrs::storage::StorageHandle

source ·
pub struct StorageHandle<TStorage: ?Sized>(/* private fields */);
Expand description

A storage handle.

This is a handle to borrowed storage which can be owned and cloned, even if the storage it references is unsized.

Implementations§

source§

impl<TStorage: ?Sized> StorageHandle<TStorage>

source

pub const fn new(storage: Arc<TStorage>) -> Self

Create a new storage handle.

Trait Implementations§

source§

impl<TStorage: ?Sized + AsyncListableStorageTraits> AsyncListableStorageTraits for StorageHandle<TStorage>

Available on crate feature async only.
source§

fn list<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<StoreKeys, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve all StoreKeys in the store. Read more
source§

fn list_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorePrefix ) -> Pin<Box<dyn Future<Output = Result<StoreKeys, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve all StoreKeys with a given StorePrefix. Read more
source§

fn list_dir<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorePrefix ) -> Pin<Box<dyn Future<Output = Result<StoreKeysPrefixes, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve all StoreKeys and StorePrefix which are direct children of StorePrefix. Read more
source§

impl<TStorage: ?Sized + AsyncReadableStorageTraits> AsyncReadableStorageTraits for StorageHandle<TStorage>

Available on crate feature async only.
source§

fn get<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StoreKey ) -> Pin<Box<dyn Future<Output = Result<MaybeBytes, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve the value (bytes) associated with a given StoreKey. Read more
source§

fn get_partial_values_key<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, key: &'life1 StoreKey, byte_ranges: &'life2 [ByteRange] ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Vec<u8>>>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieve partial bytes from a list of byte ranges for a store key. Read more
source§

fn get_partial_values<'life0, 'life1, 'async_trait>( &'life0 self, key_ranges: &'life1 [StoreKeyRange] ) -> Pin<Box<dyn Future<Output = Result<Vec<MaybeBytes>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve partial bytes from a list of StoreKeyRange. Read more
source§

fn size_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorePrefix ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the size in bytes of all keys under prefix. Read more
source§

fn size_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StoreKey ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return the size in bytes of the value at key. Read more
source§

fn size<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<u64, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the size in bytes of the readable storage. Read more
source§

fn get_partial_values_batched_by_key<'life0, 'life1, 'async_trait>( &'life0 self, key_ranges: &'life1 [StoreKeyRange] ) -> Pin<Box<dyn Future<Output = Result<Vec<MaybeBytes>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A utility method with the same input and output as get_partial_values that internally calls get_partial_values_key with byte ranges grouped by key. Read more
source§

impl<TStorage: ?Sized + AsyncWritableStorageTraits> AsyncWritableStorageTraits for StorageHandle<TStorage>

Available on crate feature async only.
source§

fn set<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StoreKey, value: Bytes ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store bytes at a StoreKey. Read more
source§

fn set_partial_values<'life0, 'life1, 'async_trait>( &'life0 self, key_start_values: &'life1 [StoreKeyStartValue<'_>] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Store bytes according to a list of StoreKeyStartValue. Read more
source§

fn erase<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 StoreKey ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn erase_values<'life0, 'life1, 'async_trait>( &'life0 self, keys: &'life1 [StoreKey] ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Erase a list of StoreKey. Read more
source§

fn erase_prefix<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 StorePrefix ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Erase all StoreKey under StorePrefix. Read more
source§

impl<TStorage: Clone + ?Sized> Clone for StorageHandle<TStorage>

source§

fn clone(&self) -> StorageHandle<TStorage>

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<TStorage: ?Sized + ListableStorageTraits> ListableStorageTraits for StorageHandle<TStorage>

source§

fn list(&self) -> Result<StoreKeys, StorageError>

Retrieve all StoreKeys in the store. Read more
source§

fn list_prefix(&self, prefix: &StorePrefix) -> Result<StoreKeys, StorageError>

Retrieve all StoreKeys with a given StorePrefix. Read more
source§

fn list_dir( &self, prefix: &StorePrefix ) -> Result<StoreKeysPrefixes, StorageError>

Retrieve all StoreKeys and StorePrefix which are direct children of StorePrefix. Read more
source§

impl<TStorage: ?Sized + ReadableStorageTraits> ReadableStorageTraits for StorageHandle<TStorage>

source§

fn get(&self, key: &StoreKey) -> Result<MaybeBytes, StorageError>

Retrieve the value (bytes) associated with a given StoreKey. Read more
source§

fn get_partial_values_key( &self, key: &StoreKey, byte_ranges: &[ByteRange] ) -> Result<Option<Vec<Vec<u8>>>, StorageError>

Retrieve partial bytes from a list of byte ranges for a store key. Read more
source§

fn get_partial_values( &self, key_ranges: &[StoreKeyRange] ) -> Result<Vec<MaybeBytes>, StorageError>

Retrieve partial bytes from a list of StoreKeyRange. Read more
source§

fn size(&self) -> Result<u64, StorageError>

Return the total size in bytes of the storage. Read more
source§

fn size_prefix(&self, prefix: &StorePrefix) -> Result<u64, StorageError>

Return the size in bytes of all keys under prefix. Read more
source§

fn size_key(&self, key: &StoreKey) -> Result<Option<u64>, StorageError>

Return the size in bytes of the value at key. Read more
source§

fn get_partial_values_batched_by_key( &self, key_ranges: &[StoreKeyRange] ) -> Result<Vec<MaybeBytes>, StorageError>

A utility method with the same input and output as get_partial_values that internally calls get_partial_values_key with byte ranges grouped by key. Read more
source§

impl<TStorage: ?Sized + WritableStorageTraits> WritableStorageTraits for StorageHandle<TStorage>

source§

fn set(&self, key: &StoreKey, value: &[u8]) -> Result<(), StorageError>

Store bytes at a StoreKey. Read more
source§

fn set_partial_values( &self, key_start_values: &[StoreKeyStartValue<'_>] ) -> Result<(), StorageError>

Store bytes according to a list of StoreKeyStartValue. Read more
source§

fn erase(&self, key: &StoreKey) -> Result<(), StorageError>

source§

fn erase_values(&self, keys: &[StoreKey]) -> Result<(), StorageError>

Erase a list of StoreKey. Read more
source§

fn erase_prefix(&self, prefix: &StorePrefix) -> Result<(), StorageError>

Erase all StoreKey under StorePrefix. Read more
source§

impl<TStorage: ?Sized + AsyncReadableWritableStorageTraits> AsyncReadableWritableStorageTraits for StorageHandle<TStorage>

Available on crate feature async only.
source§

impl<TStorage: ?Sized + ReadableWritableStorageTraits> ReadableWritableStorageTraits for StorageHandle<TStorage>

Auto Trait Implementations§

§

impl<TStorage> Freeze for StorageHandle<TStorage>
where TStorage: ?Sized,

§

impl<TStorage> RefUnwindSafe for StorageHandle<TStorage>
where TStorage: RefUnwindSafe + ?Sized,

§

impl<TStorage> Send for StorageHandle<TStorage>
where TStorage: Sync + Send + ?Sized,

§

impl<TStorage> Sync for StorageHandle<TStorage>
where TStorage: Sync + Send + ?Sized,

§

impl<TStorage> Unpin for StorageHandle<TStorage>
where TStorage: ?Sized,

§

impl<TStorage> UnwindSafe for StorageHandle<TStorage>
where TStorage: RefUnwindSafe + ?Sized,

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> DynClone for T
where T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

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, 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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.
source§

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

source§

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> AsyncReadableListableStorageTraits for T

source§

impl<T> AsyncReadableWritableListableStorageTraits for T

source§

impl<T> ReadableListableStorageTraits for T

source§

impl<T> ReadableWritableListableStorageTraits for T