Trait KVStore
pub trait KVStore: Send + Sync {
// Required methods
fn get(&self, key: Key) -> Result<Option<Value>, KVStoreError>;
fn atomic_write<'a>(
&'a self,
changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>,
) -> Result<(), KVStoreError>;
}Expand description
Abstraction for a generic key-value store.
Required Methods§
fn get(&self, key: Key) -> Result<Option<Value>, KVStoreError>
fn get(&self, key: Key) -> Result<Option<Value>, KVStoreError>
Retrieve the value mapped from the given key.
fn atomic_write<'a>(
&'a self,
changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>,
) -> Result<(), KVStoreError>
fn atomic_write<'a>( &'a self, changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>, ) -> Result<(), KVStoreError>
Write a batch of updates with atomicity to the store. Any changes written should be immediately visible in Self::get.