Documentation
¶
Overview ¶
Package steady reads and replaces files that another process may be replacing at that moment. On Windows a file being renamed over refuses to open, and one held open refuses to be renamed over, both for a moment ("Access is denied"): read as none, a file of accounts is no accounts, and the next write leaves them out. A file being renamed over is also, for a moment (two milliseconds seen), not there at all, to another process or thread: Stat and ReadThere wait that out for a file that was there. Elsewhere a rename is atomic and these are os.Stat, os.ReadFile and os.Rename.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Sync = (*os.File).Sync
Sync is (*os.File).Sync; a test stands in for it to make a flush fail.
Functions ¶
func ReadThere ¶ added in v0.1.945
ReadThere is ReadFile of a file just found there (Stat): not there now is it being replaced, waited out.
func Stat ¶ added in v0.1.945
Stat is os.Stat of a file that was there: one being replaced is waited for, so it isn't taken for gone. A file not there costs the wait, so a caller asking again remembers it gone (filememo does).
func WriteFile ¶ added in v0.1.1166
WriteFile replaces p with b, mode perm, through a temp file beside it that is flushed to the disk before it is renamed over p. A rename reaches the disk on its own schedule and the data behind it later: a Windows machine that went down between the two left logins.json and plugin-auth.json at their full length with every byte zero (#1505). A write or flush that fails removes the temp file and leaves p as it was.
Types ¶
This section is empty.