Skip to main content

recover_last_seq

Function recover_last_seq 

Source
pub fn recover_last_seq(events_path: &Path) -> Result<u64>
Expand description

Read the last seq from events.jsonl, or 0 if empty/missing.

Tolerates:

  • lines larger than any fixed buffer (node.report payloads can be 10s of KB per design.md §1.4) — we scan backwards in chunks for the previous \n.
  • a crash-truncated final line lacking a trailing \n — that partial tail is discarded and recovery uses the last complete record.

Caller must already hold the run’s RunLock for correctness against concurrent appenders.