Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchDir ¶ added in v0.12.0
WatchDir returns an fsnotify watcher on dir. On macOS and the BSDs, fsnotify lists dir and then inspects every file in it while it adds the watch, so a file removed in between fails the add with fs.ErrNotExist. WatchDir then closes that watcher, calls onRetry with the error when onRetry is not nil, and sets the watch up again on a new watcher every watchRetryInterval. It returns the error of the last attempt after watchAttempts, and ctx.Err() when ctx is done first. Any other error, and fs.ErrNotExist when dir itself is gone, is returned as it is.
func WriteFileAtomic ¶
WriteFileAtomic writes data to dir/name atomically using a temp file and rename. This ensures readers never observe a partially-written file. Both the file contents and the rename are fsynced, so the write survives a host power loss and not merely a process crash.
Types ¶
This section is empty.