Skip to main content

write_snapshot_bak

Function write_snapshot_bak 

Source
pub fn write_snapshot_bak(dir: &Path, bytes: &[u8]) -> Result<()>
Expand description

Write bytes to snapshot.bin.bak atomically with full fsync.

Uses RealFs::write_atomic which applies F_FULLFSYNC on macOS and sync_all on other platforms, then renames the .tmp file into place and syncs the directory entry. This is the only correct path for writing the .bak — plain std::fs::write + sync_all misses both F_FULLFSYNC and the directory sync.