Trait raft_engine::internals::ReplayMachine
source · pub trait ReplayMachine: Send {
// Required methods
fn replay(
&mut self,
item_batch: LogItemBatch,
file_id: FileId
) -> Result<()>;
fn merge(&mut self, rhs: Self, queue: LogQueue) -> Result<()>;
}Expand description
ReplayMachine is a type of deterministic state machine that obeys
associative law.
Sequentially arranged log items can be divided and replayed to several
ReplayMachines, and their merged state will be the same as when
replayed to one single ReplayMachine.
This abstraction is useful for recovery in parallel: a set of log files can be replayed in a divide-and-conquer fashion.