KeyValueLoad

Trait KeyValueLoad 

Source
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.

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.

Implementations on Foreign Types§

Source§

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

Source§

type Error = <K as KeyValueLoad>::Error

Source§

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§