Trait raft_engine::internals::ReplayMachine
source · [−]pub trait ReplayMachine: Send {
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.
Required Methods
Inputs a batch of log items from the given file to this machine. Returns whether the input sequence up till now is accepted.