Expand description
The temp-plus-rename writer every landing write goes through, and the staged transaction an apply commits several writes through.
A plain fs::write interrupted mid-call leaves a truncated file that
is valid-looking YAML until a forge parses it. Writing beside the
destination and renaming over it makes each write land whole or not at
all; the rename stays in one directory, which is what keeps it atomic
on POSIX filesystems. A transaction stages every write first and
renames them in order afterwards, so an interruption leaves each
destination holding either its previous bytes or its new ones, and
the caller learns which renames landed.
Structs§
- Interrupted
- A commit that stopped part way: what landed, and what did not.
- Transaction
- Several writes staged beside their destinations, renamed over them in order on commit; a staged file that is never committed is removed when the transaction drops.
Functions§
- write
- Write
bytesatpaththrough a same-directory temporary file and a rename, creating the parent directories it needs.