Skip to main content

Module undo

Module undo 

Source
Expand description

Undo system for queue mutations.

Responsibilities:

  • Create snapshots before queue-modifying operations.
  • List available snapshots for undo.
  • Restore queue state from snapshots.
  • Prune old snapshots to enforce retention limits.

Not handled here:

  • CLI argument parsing (see cli::undo).
  • Queue lock acquisition (callers must hold lock).

Invariants/assumptions:

  • Snapshots capture BOTH queue.json and done.json atomically.
  • Snapshots are written atomically via fsutil::write_atomic.
  • Callers hold queue locks during snapshot creation and restore.

Structs§

RestoreResult
Result of a restore operation.
SnapshotList
Result of listing snapshots.
UndoSnapshot
Full snapshot content (stored in JSON file).
UndoSnapshotMeta
Metadata about a single undo snapshot.

Functions§

create_undo_snapshot
Create a snapshot before a mutation operation.
list_undo_snapshots
List available undo snapshots, newest first.
load_undo_snapshot
Load a full snapshot by ID.
prune_old_undo_snapshots
Prune old snapshots to enforce retention limit.
restore_from_snapshot
Restore queue state from a snapshot.
undo_cache_dir
Get the undo cache directory path.