Documentation
¶
Overview ¶
Package fsatomic writes files so a reader never observes a partial file and a crash cannot lose the previous contents: write to a sibling temp file, fsync it, rename over the destination, then fsync the directory so the rename itself is durable. The rename-only idiom used before this package left a window where the data sat in the page cache with no durability at all.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteFile ¶
WriteFile atomically replaces path with data at the given permissions. The temp file is created in the destination directory (rename is only atomic within one filesystem) with owner-only access, then chmodded to perm before the rename, so the final mode never appears with looser intermediate access. On any failure the temp file is removed and the previous contents of path are untouched.
Types ¶
This section is empty.