Documentation
¶
Overview ¶
Package fsatomic provides a crash-durable atomic file write.
The common "write a temp file then rename over the target" idiom gives atomicity (a reader sees either the old or the new file, never a torn one), but NOT durability: without an fsync, a power loss or kernel crash can land the rename in the directory while the file's data is still only in the page cache, leaving an empty or truncated file after reboot. For data the agent can't reconstruct — conversation sessions, extracted memories — that is silent data loss.
WriteFile closes the gap: it fsyncs the file data before the rename and fsyncs the parent directory after, so a successful return means the bytes are durably on disk. It also uses a unique temp name, so two concurrent writers to the same target can't clobber each other's temp file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.