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