Expand description
Crash-safe persistence (DESIGN.md §7).
Never truncate-then-write: every overwrite goes through a temp file in the
same directory + fs::rename, so a crash mid-write leaves either the old
or the new content, never neither (invariant #6). Backups copy the
original bytes before the rename, mirroring the tree structure under
--backup-dir.
Functions§
- atomic_
write - Atomically replace
pathwithbytes. - backup_
original - Copy the original bytes of
pathintobackup_dir, mirroring the tree structure relative toroot.