io: add platform-aware fsync helpers (dir + durable file sync)

Add an io::fsync module with a per-OS split (posix/windows) mirroring the
writeback_file convention, replacing two duplicated dir-fsync copies:

- dir(): POSIX directory fsync; a no-op on Windows, where std cannot open
  a directory as a File and the failed open logged a spurious warning on
  every mapfile write.
- file_durable(): opens the target read+write before sync_all so the flush
  succeeds on Windows, where FlushFileBuffers rejects a read-only handle
  with ERROR_ACCESS_DENIED.

Point the mapfile writer at the shared dir() helper.
This commit is contained in:
Matthew Jackson
2026-06-23 12:38:02 -07:00
parent 008c1f143e
commit d5afeb6088
5 changed files with 126 additions and 22 deletions
+1
View File
@@ -30,6 +30,7 @@
pub(crate) mod bounded;
pub mod byte_prefetcher;
pub mod file_sector_source;
pub mod fsync;
pub mod sink;
mod writeback;
mod writeback_file;