pub trait Snapshotable: Send + Sync {
type Key: Clone + Eq + Hash + Send + Sync;
type State: Clone + Send + Sync;
// Required methods
fn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Self::Key, Self::State>, SnapshotError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn restore<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 Self::Key,
state: Self::State,
) -> Pin<Box<dyn Future<Output = Result<(), SnapshotError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn clear_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), SnapshotError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for services that can be snapshotted.
Implement this for any service whose state needs to be persisted and restored atomically with stream offsets.
Required Associated Types§
Required Methods§
Sourcefn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Self::Key, Self::State>, SnapshotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HashMap<Self::Key, Self::State>, SnapshotError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all states keyed by identifier.