Skip to main content

KvStore

Trait KvStore 

Source
pub trait KvStore:
    Debug
    + Send
    + Sync {
Show 13 methods // Required methods fn get(&self, key: &[u8]) -> Option<Bytes>; fn set(&mut self, key: &[u8], value: Bytes); fn compare_and_swap( &mut self, key: &[u8], old: Option<Bytes>, new: Bytes, ) -> bool; fn remove(&mut self, key: &[u8]) -> Option<Bytes>; fn contains_key(&self, key: &[u8]) -> bool; fn scan( &self, start: Bound<&[u8]>, end: Bound<&[u8]>, ) -> Box<dyn DoubleEndedIterator<Item = (Bytes, Bytes)> + '_>; fn len(&self) -> usize; fn is_empty(&self) -> bool; fn size(&self) -> usize; fn export_all(&mut self) -> Bytes; fn import_all(&mut self, bytes: Bytes) -> Result<(), String>; fn clone_store(&self) -> Arc<Mutex<dyn KvStore>> ⓘ; // Provided method fn import_all_unchecked(&mut self, bytes: Bytes) -> Result<(), String> { ... }
}

Required Methods§

Source

fn get(&self, key: &[u8]) -> Option<Bytes>

Source

fn set(&mut self, key: &[u8], value: Bytes)

Source

fn compare_and_swap( &mut self, key: &[u8], old: Option<Bytes>, new: Bytes, ) -> bool

Source

fn remove(&mut self, key: &[u8]) -> Option<Bytes>

Source

fn contains_key(&self, key: &[u8]) -> bool

Source

fn scan( &self, start: Bound<&[u8]>, end: Bound<&[u8]>, ) -> Box<dyn DoubleEndedIterator<Item = (Bytes, Bytes)> + '_>

Source

fn len(&self) -> usize

Source

fn is_empty(&self) -> bool

Source

fn size(&self) -> usize

Source

fn export_all(&mut self) -> Bytes

Source

fn import_all(&mut self, bytes: Bytes) -> Result<(), String>

Source

fn clone_store(&self) -> Arc<Mutex<dyn KvStore>> ⓘ

Provided Methods§

Source

fn import_all_unchecked(&mut self, bytes: Bytes) -> Result<(), String>

Like Self::import_all, but for callers that already guarantee the blob’s integrity via an outer checksum, so per-block checksums may be skipped. The default falls back to the checked Self::import_all; only override it where the fast path is safe (e.g. SsTable-backed stores).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl KvStore for BTreeMap<Bytes, Bytes>

Source§

fn get(&self, key: &[u8]) -> Option<Bytes>

Source§

fn set(&mut self, key: &[u8], value: Bytes)

Source§

fn compare_and_swap( &mut self, key: &[u8], old: Option<Bytes>, new: Bytes, ) -> bool

Source§

fn remove(&mut self, key: &[u8]) -> Option<Bytes>

Source§

fn contains_key(&self, key: &[u8]) -> bool

Source§

fn scan( &self, start: Bound<&[u8]>, end: Bound<&[u8]>, ) -> Box<dyn DoubleEndedIterator<Item = (Bytes, Bytes)> + '_>

Source§

fn len(&self) -> usize

Source§

fn is_empty(&self) -> bool

Source§

fn size(&self) -> usize

Source§

fn export_all(&mut self) -> Bytes

Source§

fn import_all(&mut self, bytes: Bytes) -> Result<(), String>

Source§

fn clone_store(&self) -> Arc<Mutex<dyn KvStore>> ⓘ

Implementors§