pub struct StateStore { /* private fields */ }Expand description
Main state store for managing stateful operations
Implementations§
Source§impl StateStore
impl StateStore
Sourcepub fn new(backend: StateBackend) -> Self
pub fn new(backend: StateBackend) -> Self
Create a new state store with default config
Sourcepub fn with_config(config: StateConfig) -> Self
pub fn with_config(config: StateConfig) -> Self
Create a state store with custom configuration
Sourcepub fn put(&mut self, key: impl Into<String>, value: Value) -> StateResult<()>
pub fn put(&mut self, key: impl Into<String>, value: Value) -> StateResult<()>
Put a value into state
Sourcepub fn put_with_ttl(
&mut self,
key: impl Into<String>,
value: Value,
ttl: Duration,
) -> StateResult<()>
pub fn put_with_ttl( &mut self, key: impl Into<String>, value: Value, ttl: Duration, ) -> StateResult<()>
Put a value with custom TTL
Sourcepub fn delete(&mut self, key: &str) -> StateResult<()>
pub fn delete(&mut self, key: &str) -> StateResult<()>
Delete a value from state
Sourcepub fn clear(&mut self) -> StateResult<()>
pub fn clear(&mut self) -> StateResult<()>
Clear all state
Sourcepub fn cleanup_expired(&mut self) -> usize
pub fn cleanup_expired(&mut self) -> usize
Clean up expired entries
Sourcepub fn checkpoint(&mut self, name: impl Into<String>) -> StateResult<String>
pub fn checkpoint(&mut self, name: impl Into<String>) -> StateResult<String>
Create a checkpoint of current state
Sourcepub fn restore(&mut self, checkpoint_id: &str) -> StateResult<()>
pub fn restore(&mut self, checkpoint_id: &str) -> StateResult<()>
Restore state from a checkpoint
Sourcepub fn list_checkpoints(&self) -> Vec<CheckpointMetadata>
pub fn list_checkpoints(&self) -> Vec<CheckpointMetadata>
List all checkpoints
Sourcepub fn latest_checkpoint(&self) -> Option<CheckpointMetadata>
pub fn latest_checkpoint(&self) -> Option<CheckpointMetadata>
Get the latest checkpoint
Sourcepub fn statistics(&self) -> StateStatistics
pub fn statistics(&self) -> StateStatistics
Get state statistics
Auto Trait Implementations§
impl Freeze for StateStore
impl RefUnwindSafe for StateStore
impl Send for StateStore
impl Sync for StateStore
impl Unpin 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