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 put_multi(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), Error>> + Send;
// Provided method
fn put_multi_sync(
&mut self,
index: u64,
key: Self::Key,
value: Self::Value,
) -> impl Future<Output = Result<(), 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. As with Archive::put, keys are assumed to be globally
unique, but duplicate keys are not rejected.
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 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.