Skip to main content

plan_rewind

Function plan_rewind 

Source
pub fn plan_rewind(log_path: &Path, to_turn: usize) -> Result<RewindPlan>
Expand description

Compute a RewindPlan for rewinding to_turn.

to_turn is the turn index whose start state we want to restore. So to_turn = 0 undoes everything; to_turn = 3 preserves turns 0..=2 and undoes 3 and later.

Goal 284: with on-demand checkpoints, the target checkpoint is the id field of the most recent log entry with turn < to_turn, or the pre field of the entry for to_turn (old auto-snapshot sessions). If neither is available, returns an error.

Returns an error if the log doesn’t reach to_turn or if no suitable checkpoint was recorded.