pub fn atomic_write_fsync(tmp: &Path, dst: &Path, bytes: &[u8]) -> Result<()>Expand description
Atomically write bytes to dst via a tmp file with full durability.
Order of operations (must not change):
- Create / truncate
tmpand writebytes. sync_data()ontmp— forces file data pages to stable storage.rename(tmp, dst)— atomic on POSIX filesystems.fsync_directory(parent)— forces the directory entry durable so the new name survives power loss.
tmp and dst MUST be in the same directory; otherwise rename is not
atomic and the parent fsync won’t cover both entries.