Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Dir ¶
type Dir struct {
// contains filtered or unexported fields
}
Dir represents a temporary directory that can on success be "committed" to the provided path and rolled back otherwise.
func (*Dir) Commit ¶
Commit commits the temporary directory to the original path by deleting the original path, if necessary, and moving the temporary directory to the original's path location.
func (*Dir) OriginalPath ¶
OriginalPath returns the path to the original directory.
type File ¶
File represents a temporary file that on success can be "committed" to the provided path and rolled back otherwise.
func CreateFile ¶
CreateFile creates a temporary file that can be either atomically committed to the given path or discarded.
func (*File) Commit ¶
Commit flushes all unwritten changes to disk, closes the underlying temporary file, making it impossible to apply any changes, and commits the temporary file to the original path.
Commit can be called repeatedly in case of an error to resolve the returned problem and try again until the changes have been committed successfully or abandoned.
func (*File) OriginalPath ¶
OriginalPath returns the path to the original file.