pub struct InMemoryStateBackend { /* private fields */ }Expand description
In-memory StateBackend — fast but not durable across process restarts.
Implementations§
Trait Implementations§
Source§impl Default for InMemoryStateBackend
impl Default for InMemoryStateBackend
Source§impl StateBackend for InMemoryStateBackend
impl StateBackend for InMemoryStateBackend
Source§fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StreamError>
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, StreamError>
Return the value for the given key, or
None if absent.Source§fn put(&self, key: &[u8], value: &[u8]) -> Result<(), StreamError>
fn put(&self, key: &[u8], value: &[u8]) -> Result<(), StreamError>
Insert or overwrite a key-value pair.
Source§fn delete(&self, key: &[u8]) -> Result<bool, StreamError>
fn delete(&self, key: &[u8]) -> Result<bool, StreamError>
Remove a key. Returns
true if the key previously existed.Source§fn range_scan(
&self,
prefix: &[u8],
) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StreamError>
fn range_scan( &self, prefix: &[u8], ) -> Result<Vec<(Vec<u8>, Vec<u8>)>, StreamError>
Return all entries whose key starts with
prefix.Source§fn checkpoint(&self, checkpoint_id: u64) -> Result<Vec<u8>, StreamError>
fn checkpoint(&self, checkpoint_id: u64) -> Result<Vec<u8>, StreamError>
Serialize the current state into an opaque byte snapshot tagged with
checkpoint_id.Source§fn restore(&self, snapshot: &[u8]) -> Result<(), StreamError>
fn restore(&self, snapshot: &[u8]) -> Result<(), StreamError>
Replace current state with the content of a previously-created snapshot.
Source§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
Approximate heap/disk footprint in bytes.
Auto Trait Implementations§
impl Freeze for InMemoryStateBackend
impl RefUnwindSafe for InMemoryStateBackend
impl Send for InMemoryStateBackend
impl Sync for InMemoryStateBackend
impl Unpin for InMemoryStateBackend
impl UnsafeUnpin for InMemoryStateBackend
impl UnwindSafe for InMemoryStateBackend
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.