0.18 primitive: rename crate::io::Writer → WritebackFile

The type's job is the bounded-cache writeback pipeline (sync_file_range
+ posix_fadvise(DONTNEED)) — not generic writing. The 0.17 name was
ambiguous; reading `Writer::new(file)` gave no hint about what was
special. New name makes the role obvious at every call site.

Adds `WritebackFile::create(path)` and `WritebackFile::open(path)`
constructors so callers don't have to assemble a `File` first.

No alias kept; this is a clean 0.18 rename. See
(internal)/memory/0_18_redesign.md.

Single contributor: MattJackson.
This commit is contained in:
MattJackson
2026-05-09 08:53:17 -07:00
parent 6ec97af104
commit 5f3545d244
6 changed files with 141 additions and 115 deletions
+11 -11
View File
@@ -1,16 +1,16 @@
//! File I/O helpers that bound kernel cache pressure on big writes.
//!
//! `Writer` is a drop-in wrapper around `std::fs::File` for any call
//! site that performs large sequential writes (sweep, mux, etc.). It
//! implements `Write` and `Seek` so existing code paths can swap
//! `File` for `Writer` with no body changes. Internally it drives a
//! `WritebackPipeline` that, on Linux, drains dirty pages continuously
//! at 32 MB granularity to avoid the kernel's accumulate-then-burst
//! flush behaviour. macOS and Windows use a no-op pipeline — their
//! default cache policies have not been shown to exhibit the same
//! pathology for this access pattern.
//! `WritebackFile` is a drop-in wrapper around `std::fs::File` for any
//! call site that performs large sequential writes (sweep, patch, mux,
//! etc.). It implements `Write` and `Seek` so existing code paths can
//! swap `File` for `WritebackFile` with no body changes. Internally it
//! drives a `WritebackPipeline` that, on Linux, drains dirty pages
//! continuously at 32 MB granularity to avoid the kernel's
//! accumulate-then-burst flush behaviour. macOS and Windows use a
//! no-op pipeline — their default cache policies have not been shown
//! to exhibit the same pathology for this access pattern.
mod writeback;
mod writer;
mod writeback_file;
pub(crate) use writer::Writer;
pub(crate) use writeback_file::WritebackFile;