Skip to content

Snapshots and history

There are two related but different mechanisms:

  • engine.snapshot() returns an IEngineSnapshot containing the base64 CRDT document, serialized action history, and registered policy names. engine.restore(snapshot) loads it when no network or sync is attached.
  • HistoryManager keeps in-memory undo history and periodic CRDT checkpoints. It checkpoints every 50 actions and retains at most five checkpoints, rather than storing a full document snapshot for every action.

Undo is coarse-grained: it restores the nearest available checkpoint, up to the checkpoint interval away, and can return null when no suitable checkpoint exists. A persisted engine.persist() save contains the Chronicle document; resume() restores the document and clears the current Engine's stale action history/checkpoints. It is not a durable action-log backup.