pub struct StateStore { /* private fields */ }Expand description
Thread-safe state store with transition logging.
All reads and writes go through this store. Every write produces a StateTransition record for audit and replay.
Implementations§
Source§impl StateStore
impl StateStore
pub fn new() -> Self
pub fn get(&self, key: &str) -> Option<Value>
pub fn get_or(&self, key: &str, default: Value) -> Value
pub fn exists(&self, key: &str) -> bool
pub fn set(&self, key: &str, value: Value, action_id: &str) -> StateTransition
pub fn delete(&self, key: &str, action_id: &str) -> Option<StateTransition>
Sourcepub fn restore(&self, snapshot: HashMap<String, Value>, transition_count: usize)
pub fn restore(&self, snapshot: HashMap<String, Value>, transition_count: usize)
Restore state from a snapshot, truncating transitions.
pub fn transition_count(&self) -> usize
pub fn transitions(&self) -> Vec<StateTransition>
pub fn transitions_since(&self, index: usize) -> Vec<StateTransition>
pub fn keys(&self) -> Vec<String>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for StateStore
impl !RefUnwindSafe for StateStore
impl Send for StateStore
impl Sync for StateStore
impl Unpin for StateStore
impl UnsafeUnpin for StateStore
impl UnwindSafe for StateStore
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