pub trait StateManager: Send + Sync {
Show 14 methods
// Required methods
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>>
where T: 'async_trait + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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>>
where T: 'async_trait + Serialize + Send + Sync,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: '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;
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 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 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 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 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 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 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 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 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 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 clear_expired<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Persistent state storage abstraction
Required Methods§
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.