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>

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>

Write a batch of updates with atomicity to the store. Any changes written should be immediately visible in Self::get.

Implementations on Foreign Types§

§

impl<T: KVStore + ?Sized> KVStore for Box<T>

§

fn get(&self, key: Key) -> Result<Option<Value>, KVStoreError>

§

fn atomic_write<'a>( &self, changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>, ) -> Result<(), KVStoreError>

§

impl<T: KVStore + ?Sized> KVStore for Arc<T>

§

fn get(&self, key: Key) -> Result<Option<Value>, KVStoreError>

§

fn atomic_write<'a>( &self, changes: Box<dyn Iterator<Item = (Key, Option<Value>)> + 'a>, ) -> Result<(), KVStoreError>

Implementors§