pub trait RaftStorage<D, E> where
D: AppData,
E: AppError,
Self: Actor<Context = Context<Self>>,
Self: Handler<GetInitialState<E>>,
Self::Context: ToEnvelope<Self, GetInitialState<E>>,
Self: Handler<SaveHardState<E>>,
Self::Context: ToEnvelope<Self, SaveHardState<E>>,
Self: Handler<GetLogEntries<D, E>>,
Self::Context: ToEnvelope<Self, GetLogEntries<D, E>>,
Self: Handler<AppendLogEntry<D, E>>,
Self::Context: ToEnvelope<Self, AppendLogEntry<D, E>>,
Self: Handler<ReplicateLogEntries<D, E>>,
Self::Context: ToEnvelope<Self, ReplicateLogEntries<D, E>>,
Self: Handler<ApplyToStateMachine<D, E>>,
Self::Context: ToEnvelope<Self, ApplyToStateMachine<D, E>>,
Self: Handler<CreateSnapshot<E>>,
Self::Context: ToEnvelope<Self, CreateSnapshot<E>>,
Self: Handler<InstallSnapshot<E>>,
Self::Context: ToEnvelope<Self, InstallSnapshot<E>>,
Self: Handler<GetCurrentSnapshot<E>>,
Self::Context: ToEnvelope<Self, GetCurrentSnapshot<E>>, {
fn new(members: Vec<NodeId>, snapshot_dir: String) -> Self;
}
A trait defining the interface of a Raft storage actor.
See the storage chapter of the guide
for details and discussion on this trait and how to implement it.
fn new(members: Vec<NodeId>, snapshot_dir: String) -> Self
Create a new instance which will store its snapshots in the given directory.
The values given to this constructor should only be used when the node is coming online
for the first time. Otherwise the persistent storage should always take precedence.
The value given for members
is used as the initial cluster config when the node comes
online for the first time. For brand new nodes, this allows you to seed the ID of the node
in the initial HardState.
Loading content...
Loading content...