Skip to main content

Module fs_util

Module fs_util 

Source
Expand description

Atomic write helpers shared across store/*.

Replaces the per-module atomic_write copies that lived in super::issues and super::session. Those copies named the temp file tmp.<pid>, which collides under PID-namespace recycling (containers) or fork+exec where two live processes can share a PID and stomp each other’s temp. The temp name here is <path>.tmp.<pid>.<uuid> — PID kept for debuggability, the UUID guarantees uniqueness.

§Durability

fs::rename is atomic but not durable (no fsync). This matches the existing CLI consistency model; durability is an explicit opt-in left for a future atomic_write_durable if a caller needs it. Out of P1 scope.

Functions§

atomic_write
Atomically write UTF-8 content to path (temp file + rename).
atomic_write_bytes
Atomically write raw bytes to path (temp file + rename).