Skip to main content

Module atomic

Module atomic 

Source
Expand description

The temp-plus-rename writer every landing write goes 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.

Functionsยง

write
Write bytes at path through a same-directory temporary file and a rename, creating the parent directories it needs.