Trait openraft::storage::RaftSnapshotBuilder

source ·
pub trait RaftSnapshotBuilder<C>: OptionalSend + OptionalSync + 'static + Send
where C: RaftTypeConfig,
{ // Required method fn build_snapshot( &mut self ) -> impl Future<Output = Result<Snapshot<C>, StorageError<C::NodeId>>> + Send; }
Expand description

A trait defining the interface for a Raft state machine snapshot subsystem.

This interface is accessed read-only from snapshot building task.

Typically, the snapshot implementation as such will be hidden behind a reference type like Arc<T> or Box<T> and this interface implemented on the reference type. It can be co-implemented with RaftStorage interface on the same cloneable object, if the underlying state machine is anyway synchronized.

Required Methods§

source

fn build_snapshot( &mut self ) -> impl Future<Output = Result<Snapshot<C>, StorageError<C::NodeId>>> + Send

Build snapshot

A snapshot has to contain state of all applied log, including membership. Usually it is just a serialized state machine.

Building snapshot can be done by:

  • Performing log compaction, e.g. merge log entries that operates on the same key, like a LSM-tree does,
  • or by fetching a snapshot from the state machine.

Object Safety§

This trait is not object safe.

Implementors§