Expand description
Installing a local file’s complete contents so a crash leaves either the old bytes or the new ones, never a partial write.
This module is the crate’s blessed implementation of the durable write, and
the only place allowed to call the raw sync methods that clippy.toml
disallows everywhere else. Keeping it to one place is what lets the
platform split below — Unix flushes the parent directory, nothing else can —
stay correct in a single spot instead of in every caller.
Structs§
- Atomic
File - One local file whose complete contents are installed with a durable rename.
- Atomic
File Stage - One unpublished file whose destination is chosen after its bytes have been
written. This is the streaming counterpart to
write_atomic: callers can compute a content address while implementingstd::io::Write, then commit the completed file under that address with the owning durability policy’s file-sync, rename, and directory-sync sequence.
Enums§
- File
Error - A local filesystem operation that failed without erasing its I/O cause.
- Write
Error - A failed atomic write, tagged with whether the write had already committed.
Functions§
- is_
atomic_ staging_ file_ name - Whether a directory entry is an unpublished sibling left by this module’s atomic writer. Callers that enumerate committed records exclude these; they are not part of the durable record set until renamed onto a target.
- sync_
parent_ dir - Flush the directory entry a rename onto
pathjust wrote, so the installed file survives a crash. Every durable rename in the crate ends here. - sync_
parent_ dir_ blocking sync_parent_dirfor callers that are not on the async runtime.- write_
atomic - Install
bytesas the complete contents ofpath.