Skip to main content

apply

Function apply 

Source
pub fn apply(state: &mut RunState, event: &JournalEvent)
Expand description

Apply a single event to state, in place.

Idempotent: an event whose seq is at or below state.applied_seq is skipped (the high-water mark), and every mutation targets a keyed set/map, so re-applying a seen event leaves the state byte-identical. This is what makes append-then-apply crash-safe — replaying after a crash is a clean no-op-or-apply.

Terminal-safe: once the run is RunStatus::Completed or RunStatus::Abandoned, further events are ignored (the watermark still advances so a later legitimate replay is consistent), so a corrupt log cannot mutate a run past its terminal fact.