Trait async_mwmr::AsyncPendingManager
source · pub trait AsyncPendingManager: Send + Sync + 'static {
type Error: Error + Send + Sync + 'static;
type Key: Send + Sync + 'static;
type Value: Send + Sync + 'static;
// Required methods
fn is_empty(&self) -> bool;
fn len(&self) -> usize;
fn get(
&self,
key: &Self::Key
) -> impl Future<Output = Result<Option<&EntryValue<Self::Value>>, Self::Error>> + Send;
fn insert(
&mut self,
key: Self::Key,
value: EntryValue<Self::Value>
) -> impl Future<Output = Result<(), Self::Error>> + Send;
fn remove_entry(
&mut self,
key: &Self::Key
) -> impl Future<Output = Result<Option<(Self::Key, EntryValue<Self::Value>)>, Self::Error>> + Send;
fn keys(
&self
) -> impl Future<Output = impl Iterator<Item = &Self::Key>> + Send;
fn iter(
&self
) -> impl Future<Output = impl Iterator<Item = (&Self::Key, &EntryValue<Self::Value>)>> + Send;
fn into_iter(
self
) -> impl Future<Output = impl Iterator<Item = (Self::Key, EntryValue<Self::Value>)>> + Send;
}
Expand description
A pending writes manager that can be used to store pending writes in a transaction.
By default, there are two implementations of this trait:
IndexMap
: A hash map with consistent ordering and fast lookups.BTreeMap
: A balanced binary tree with ordered keys and fast lookups.
But, users can create their own implementations by implementing this trait. e.g. if you want to implement a recovery transaction manager, you can use a persistent storage to store the pending writes.
Required Associated Types§
Required Methods§
sourcefn get(
&self,
key: &Self::Key
) -> impl Future<Output = Result<Option<&EntryValue<Self::Value>>, Self::Error>> + Send
fn get( &self, key: &Self::Key ) -> impl Future<Output = Result<Option<&EntryValue<Self::Value>>, Self::Error>> + Send
Returns a reference to the value corresponding to the key.
sourcefn insert(
&mut self,
key: Self::Key,
value: EntryValue<Self::Value>
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn insert( &mut self, key: Self::Key, value: EntryValue<Self::Value> ) -> impl Future<Output = Result<(), Self::Error>> + Send
Inserts a key-value pair into the buffer.
sourcefn remove_entry(
&mut self,
key: &Self::Key
) -> impl Future<Output = Result<Option<(Self::Key, EntryValue<Self::Value>)>, Self::Error>> + Send
fn remove_entry( &mut self, key: &Self::Key ) -> impl Future<Output = Result<Option<(Self::Key, EntryValue<Self::Value>)>, Self::Error>> + Send
Removes a key from the buffer, returning the key-value pair if the key was previously in the buffer.
sourcefn keys(&self) -> impl Future<Output = impl Iterator<Item = &Self::Key>> + Send
fn keys(&self) -> impl Future<Output = impl Iterator<Item = &Self::Key>> + Send
Returns an iterator over the keys in the buffer.
Object Safety§
This trait is not object safe.