Skip to main content

Module writer

Module writer 

Source
Expand description

Crash-safe persistence.

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. Backups copy the original bytes before the rename, mirroring the tree structure under --backup-dir.

Functionsยง

atomic_write
Atomically replace path with bytes.
backup_original
Copy the original bytes of path into backup_dir, mirroring the tree structure relative to root.