pub trait SnapshotStore: Clone + Send + Sync + 'static {
    type Error: StdError + Send + Sync;

    fn save<'a, S, StateToBytes, StateToBytesError>(
        &'a mut self,
        id: Uuid,
        seq_no: SeqNo,
        state: S,
        state_to_bytes: &'a StateToBytes
    ) -> impl Future<Output = Result<(), Self::Error>> + Send
    where
        S: Send + Sync + 'a,
        StateToBytes: Fn(&S) -> Result<Bytes, StateToBytesError> + Send + Sync + 'static,
        StateToBytesError: StdError + Send + Sync + 'static
; fn load<'a, S, StateFromBytes, StateFromBytesError>(
        &'a self,
        id: Uuid,
        state_from_bytes: StateFromBytes
    ) -> impl Future<Output = Result<Option<Snapshot<S>>, Self::Error>> + Send
    where
        S: 'a,
        StateFromBytes: Fn(Bytes) -> Result<S, StateFromBytesError> + Copy + Send + Sync + 'static,
        StateFromBytesError: StdError + Send + Sync + 'static
; }
Expand description

Persistence for snapshots.

Required Associated Types§

Required Methods§

Save the given snapshot state for the given entity ID and sequence number.

Find and possibly load the Snapshot for the given entity ID.

Implementors§