pub struct MemoryStore { /* private fields */ }Expand description
In-memory implementation of both Collection and State.
Data is stored in a BTreeMap behind an Arc<RwLock<...>> so it can be
shared across clones. All keys in collection mode are prefixed with
"<prefix>." to avoid collisions with state-mode entries.
Trait Implementations§
Source§impl Clone for MemoryStore
impl Clone for MemoryStore
Source§fn clone(&self) -> MemoryStore
fn clone(&self) -> MemoryStore
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Collection for MemoryStore
impl Collection for MemoryStore
Source§fn last(&self) -> Result<Option<(String, Vec<u8>)>, Error>
fn last(&self) -> Result<Option<(String, Vec<u8>)>, Error>
Returns the last key-value pair in insertion/sort order, or
None if the collection is empty.Source§fn get(&self, key: &str) -> Result<Vec<u8>, Error>
fn get(&self, key: &str) -> Result<Vec<u8>, Error>
Returns the value stored under
key. Read moreSource§fn put(&mut self, key: &str, data: &[u8]) -> Result<(), Error>
fn put(&mut self, key: &str, data: &[u8]) -> Result<(), Error>
Associates
data with key, inserting or replacing any previous value.Source§impl DbManager<MemoryStore, MemoryStore> for MemoryManager
impl DbManager<MemoryStore, MemoryStore> for MemoryManager
Source§fn create_state(&self, name: &str, prefix: &str) -> Result<MemoryStore, Error>
fn create_state(&self, name: &str, prefix: &str) -> Result<MemoryStore, Error>
Creates a single-value state store, typically used to store actor snapshots. Read more
Source§fn stop(&mut self) -> Result<(), Error>
fn stop(&mut self) -> Result<(), Error>
Optional cleanup hook called when the database manager should shut down. Read more
Source§fn create_collection(
&self,
name: &str,
prefix: &str,
) -> Result<MemoryStore, Error>
fn create_collection( &self, name: &str, prefix: &str, ) -> Result<MemoryStore, Error>
Creates a new ordered key-value collection, typically used to store events. Read more
Source§impl Default for MemoryStore
impl Default for MemoryStore
Source§fn default() -> MemoryStore
fn default() -> MemoryStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MemoryStore
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnsafeUnpin for MemoryStore
impl UnwindSafe for MemoryStore
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