pub trait MultiArchive: Archive {
// Required methods
fn get_all(
&self,
index: u64,
) -> impl Future<Output = Result<Option<Vec<Self::Value>>, Error>> + Send + use<'_, Self>;
fn has_at<'a>(
&'a self,
index: u64,
key: &'a Self::Key,
) -> impl Future<Output = Result<bool, Error>> + Send + use<'a, Self>;
fn put_multi(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Error>> + Send;
// Provided methods
fn put_multi_sync(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Error>> + Send { ... }
fn put_multi_start_sync(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<Handle<()>, Error>> + Send { ... }
}Expand description
Extension of Archive that supports multiple items at the same index.
Unlike Archive::put, which is a no-op when the index already exists,
MultiArchive::put_multi allows storing additional (key, value) pairs
at an existing index.
Required Methods§
Sourcefn get_all(
&self,
index: u64,
) -> impl Future<Output = Result<Option<Vec<Self::Value>>, Error>> + Send + use<'_, Self>
fn get_all( &self, index: u64, ) -> impl Future<Output = Result<Option<Vec<Self::Value>>, Error>> + Send + use<'_, Self>
Retrieve all values stored at the given index.
Returns None if the index does not exist or has been pruned.
Sourcefn has_at<'a>(
&'a self,
index: u64,
key: &'a Self::Key,
) -> impl Future<Output = Result<bool, Error>> + Send + use<'a, Self>
fn has_at<'a>( &'a self, index: u64, key: &'a Self::Key, ) -> impl Future<Output = Result<bool, Error>> + Send + use<'a, Self>
Check whether key is stored at index.
Unlike Archive::has with Identifier::Key, the check is scoped to a single index. Unlike MultiArchive::get_all, no values are fetched.
Sourcefn put_multi(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Error>> + Send
fn put_multi( &mut self, index: u64, key: Self::Key, value: Self::Value, ) -> impl Future<Output = Result<(), Error>> + Send
Store an item, allowing multiple items at the same index.
Multiple items may share the same index. If the same key is stored at
multiple indices, any associated value may be returned when queried with
Identifier::Key.
Provided Methods§
Sourcefn put_multi_sync(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Error>> + Send
fn put_multi_sync( &mut self, index: u64, key: Self::Key, value: Self::Value, ) -> impl Future<Output = Result<(), Error>> + Send
Perform a MultiArchive::put_multi and Archive::sync in a single operation.
Sourcefn put_multi_start_sync(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<Handle<()>, Error>> + Send
fn put_multi_start_sync( &mut self, index: u64, key: Self::Key, value: Self::Value, ) -> impl Future<Output = Result<Handle<()>, Error>> + Send
Perform a MultiArchive::put_multi and Archive::start_sync in a single operation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".