Trait 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.

Required Methods§

Source

fn replay(&mut self, item_batch: LogItemBatch, file_id: FileId) -> Result<()>

Inputs a batch of log items from the given file to this machine. Returns whether the input sequence up till now is accepted.

Source

fn merge(&mut self, rhs: Self, queue: LogQueue) -> Result<()>

Merges with another ReplayMachine that has consumed newer log items in the same input sequence.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<A: AllocatorTrait> ReplayMachine for MemTableRecoverContext<A>