pub struct MemoryKVVStore { /* private fields */ }
Expand description
A key-version-value in-memory store.
Implementations§
Trait Implementations§
Source§impl KVVStore for MemoryKVVStore
impl KVVStore for MemoryKVVStore
type Iter = Iter
Source§fn put(&self, key: &str, value: Vec<u8>) -> Result<(), Error>
fn put(&self, key: &str, value: Vec<u8>) -> Result<(), Error>
Put a key-value pair into the store
Source§fn put_with_version(
&self,
key: &str,
version: u64,
value: Vec<u8>,
) -> Result<(), Error>
fn put_with_version( &self, key: &str, version: u64, value: Vec<u8>, ) -> Result<(), Error>
If the key already exists, the version must be greater than the existing version.
Source§fn put_batch(&self, kvvs: Vec<KVV>) -> Result<(), Error>
fn put_batch(&self, kvvs: Vec<KVV>) -> Result<(), Error>
Atomically put several KVVs into the store
Source§fn get(&self, key: &str) -> Result<Option<(u64, Vec<u8>)>, Error>
fn get(&self, key: &str) -> Result<Option<(u64, Vec<u8>)>, Error>
Get a key-value pair from the store
Returns Ok(None) if the key does not exist.
Source§fn get_version(&self, key: &str) -> Result<Option<u64>, Error>
fn get_version(&self, key: &str) -> Result<Option<u64>, Error>
Get the version of a key-value pair from the store
Returns Ok(None) if the key does not exist.
Source§fn get_prefix(&self, prefix: &str) -> Result<Self::Iter, Error>
fn get_prefix(&self, prefix: &str) -> Result<Self::Iter, Error>
Get all key-value pairs with the given prefix
Source§fn reset_versions(&self) -> Result<(), Error>
fn reset_versions(&self) -> Result<(), Error>
Reset the versions of all keys to 0, so that a replica can be initialized from scratch
impl SendSync for MemoryKVVStore
Auto Trait Implementations§
impl !Freeze for MemoryKVVStore
impl RefUnwindSafe for MemoryKVVStore
impl Send for MemoryKVVStore
impl Sync for MemoryKVVStore
impl Unpin for MemoryKVVStore
impl UnwindSafe for MemoryKVVStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more