Skip to main content

reconstruct

Function reconstruct 

Source
pub fn reconstruct(records: impl IntoIterator<Item = LogRecord>) -> WorldState
Expand description

Rebuild the world from records, in any arrival order, with duplicates.

Properties (tested in tests/event_sourcing.rs):

  • R-1: any arrival order respecting nothing at all — reconstruct sorts per-token by seq — yields byte-identical serialized state;
  • R-3: duplicates of (token, seq, kind-discriminant) are dropped;
  • R-2: reconstruct(prefix) + replay(suffix) ≡ reconstruct(all) — WorldState is a snapshot, and apply_suffix is the replay.