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§
- Restore
Result - Result of a restore operation.
- Snapshot
List - Result of listing snapshots.
- Undo
Snapshot - Full snapshot content (stored in JSON file).
- Undo
Snapshot Meta - 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.