Trait eventsourced::LocalSnapshotStore
source · pub trait LocalSnapshotStore: Clone + 'static {
type Id: Debug;
type Error: StdError + Send + Sync + 'static;
// Required methods
async fn save<S, ToBytes, ToBytesError>(
&mut self,
id: &Self::Id,
seq_no: NonZeroU64,
state: &S,
to_bytes: &ToBytes
) -> Result<(), Self::Error>
where S: Send + Sync,
ToBytes: Fn(&S) -> Result<Bytes, ToBytesError> + Sync,
ToBytesError: StdError + Send + Sync + 'static;
async fn load<S, FromBytes, FromBytesError>(
&self,
id: &Self::Id,
from_bytes: FromBytes
) -> Result<Option<Snapshot<S>>, Self::Error>
where FromBytes: Fn(Bytes) -> Result<S, FromBytesError> + Send,
FromBytesError: StdError + Send + Sync + 'static;
}Expand description
Persistence for snapshots.
Required Associated Types§
Required Methods§
sourceasync fn save<S, ToBytes, ToBytesError>(
&mut self,
id: &Self::Id,
seq_no: NonZeroU64,
state: &S,
to_bytes: &ToBytes
) -> Result<(), Self::Error>
async fn save<S, ToBytes, ToBytesError>( &mut self, id: &Self::Id, seq_no: NonZeroU64, state: &S, to_bytes: &ToBytes ) -> Result<(), Self::Error>
Save the given snapshot state for the given entity ID and sequence number.
Object Safety§
This trait is not object safe.