Expand description
Crash-safe file publication: write to a fresh sibling, sync it, rename it over the destination, sync the directory.
The temp file is created with create_new under an unpredictable name and
mode 0600, so a symlink or file planted at a guessable path is never
followed or truncated. One helper for the revocation log (amesh) and the
Seen record (crate::RevocationGuard), so there is a single copy of the dance.
Functionsยง
- atomic_
write - Replace
destwithbytesatomically and durably: temp file,sync_all, rename, thensync_allon the directory (Unix). On failure the temp file is removed anddestis untouched. - create_
tmp - A fresh temp file beside
dest:create_new(never follows or truncates an existing path) under an unpredictable name, mode 0600 on Unix.