pub trait KeyValueLoad {
    type Error: Debug;
    type RangeScan<'a>: Cursor<Error = Self::Error>
       where Self: 'a;

    // Required methods
    fn load(
        &self,
        key: &[u8],
        is_tombstone: &mut bool
    ) -> Result<Option<Vec<u8>>, Self::Error>;
    fn range_scan<T: AsRef<[u8]>>(
        &self,
        start_bound: &Bound<T>,
        end_bound: &Bound<T>
    ) -> Result<Self::RangeScan<'_>, Self::Error>;

    // Provided method
    fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error> { ... }
}
Expand description

A read-oriented key-value store. KeyValueLoad is a pun on register load.

Required Associated Types§

source

type Error: Debug

The type of error returned by this KeyValueLoad.

source

type RangeScan<'a>: Cursor<Error = Self::Error> where Self: 'a

The type of cursor returned from [range_scan].

Required Methods§

source

fn load( &self, key: &[u8], is_tombstone: &mut bool ) -> Result<Option<Vec<u8>>, Self::Error>

Load the newest key. Specifies is_tombstone when the None value returned is a tombstone.

source

fn range_scan<T: AsRef<[u8]>>( &self, start_bound: &Bound<T>, end_bound: &Bound<T> ) -> Result<Self::RangeScan<'_>, Self::Error>

Perform a range scan between the specified bounds.

Provided Methods§

source

fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, Self::Error>

Get the value associated with the key. By default this will call load and discard the is_tombstone parameter. This should be sufficient for every implementation.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<K: KeyValueLoad> KeyValueLoad for Arc<K>

§

type Error = <K as KeyValueLoad>::Error

§

type RangeScan<'a> = <K as KeyValueLoad>::RangeScan<'a> where Self: 'a

source§

fn load( &self, key: &[u8], is_tombstone: &mut bool ) -> Result<Option<Vec<u8>>, Self::Error>

source§

fn range_scan<T: AsRef<[u8]>>( &self, start_bound: &Bound<T>, end_bound: &Bound<T> ) -> Result<Self::RangeScan<'_>, Self::Error>

Implementors§