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§
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 Methods§
Sourcefn import_all_unchecked(&mut self, bytes: Bytes) -> Result<(), String>
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".