Documentation
¶
Overview ¶
Package atomicfile writes state files so a crash or power loss leaves either the old or the new content, never a torn one, and moves unreadable state files aside instead of letting the next save overwrite them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Quarantine ¶
Quarantine renames the unreadable file at path to <path>.corrupt-<unix seconds> (with a numeric suffix if that exists already) so nothing overwrites it, and returns a *CorruptError naming both. cause is the parse error.
Types ¶
type CorruptError ¶
type CorruptError struct {
Path string // the state file
Backup string // where its content is kept now ("" if it could not be moved)
Err error // why it could not be read (or moved)
}
CorruptError reports a state file that could not be parsed and was moved aside.
func (*CorruptError) Error ¶
func (e *CorruptError) Error() string
func (*CorruptError) Unwrap ¶
func (e *CorruptError) Unwrap() error