Documentation
¶
Overview ¶
Package durable writes a file so that a crash leaves either the old file or the whole new one under its name, never a partial one.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SyncDir ¶
SyncDir makes the names in dir durable: a caller that accepts a file it did not write itself (one an earlier Write left, perhaps before its own directory sync failed) syncs its directory before relying on it.
func Write ¶
func Write(dir, name string, body []byte, perm fs.FileMode, noReplace bool) (existed bool, err error)
Write puts body at dir/name with mode perm: written to a temporary file in dir, fsynced, moved into place and the directory fsynced. The move is a rename, replacing any file there, or with noReplace a hard link, which leaves an existing file untouched and reports existed. dir must exist.
Types ¶
This section is empty.