pub struct MemoryStateManager { /* private fields */ }Expand description
In-memory state storage (not persistent across restarts)
Implementations§
Trait Implementations§
Source§impl Clone for MemoryStateManager
impl Clone for MemoryStateManager
Source§fn clone(&self) -> MemoryStateManager
fn clone(&self) -> MemoryStateManager
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 Default for MemoryStateManager
impl Default for MemoryStateManager
Source§impl StateManager for MemoryStateManager
impl StateManager for MemoryStateManager
Source§fn save<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
state: &'life2 T,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn save<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, node_id: &'life1 str, state: &'life2 T, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Save state for a node
Source§fn save_with_options<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
state: &'life2 T,
options: StateOptions,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
fn save_with_options<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, node_id: &'life1 str, state: &'life2 T, options: StateOptions, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
Save state with options
Source§fn load<'life0, 'life1, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<T>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load state for a node
Source§fn load_versioned<'life0, 'life1, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<VersionedState<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_versioned<'life0, 'life1, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<VersionedState<T>>>> + Send + 'async_trait>>where
T: 'async_trait + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load versioned state with migration support
Source§fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete state for a node
Source§fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn exists<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if state exists for a node
Source§fn list_nodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_nodes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all node IDs with stored state
Source§fn size<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<usize>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn size<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<usize>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get state size in bytes
Source§fn create_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
description: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<StateSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
description: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<StateSnapshot>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a snapshot of current state
Source§fn restore_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn restore_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Restore from a snapshot
Source§fn list_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<StateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_snapshots<'life0, 'life1, 'async_trait>(
&'life0 self,
node_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<StateSnapshot>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List snapshots for a node
Source§fn delete_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_snapshot<'life0, 'life1, 'async_trait>(
&'life0 self,
snapshot_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a snapshot
Source§fn compare_and_swap<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
expected: &'life2 T,
new: &'life3 T,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
T: 'async_trait + Serialize + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn compare_and_swap<'life0, 'life1, 'life2, 'life3, 'async_trait, T>(
&'life0 self,
node_id: &'life1 str,
expected: &'life2 T,
new: &'life3 T,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
T: 'async_trait + Serialize + DeserializeOwned + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Atomic compare-and-swap operation
Auto Trait Implementations§
impl Freeze for MemoryStateManager
impl !RefUnwindSafe for MemoryStateManager
impl Send for MemoryStateManager
impl Sync for MemoryStateManager
impl Unpin for MemoryStateManager
impl !UnwindSafe for MemoryStateManager
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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