Documentation
¶
Overview ¶
Package fsutil provides filesystem utilities for atomic operations and syncing.
Index ¶
- Variables
- func AtomicWrite(path string, data []byte, perm os.FileMode) error
- func FsyncDir(dirPath string) error
- func FsyncTree(root string) error
- func IsCommitUncertain(err error) bool
- func RenameAndSync(oldpath, newpath string) error
- func RenameNoReplaceAndSync(oldpath, newpath string) error
- type CommitUncertainError
Constants ¶
This section is empty.
Variables ¶
var ErrRenameNoReplaceUnsupported = errors.New("atomic rename no-replace unsupported")
ErrRenameNoReplaceUnsupported reports that the current platform does not provide an atomic no-replace rename primitive.
Functions ¶
func AtomicWrite ¶
AtomicWrite writes data to a temporary file, fsyncs, then renames to target path.
func FsyncTree ¶
FsyncTree recursively fsyncs all files under the given root directory. This ensures all data is durably written to disk before marking an operation complete.
func IsCommitUncertain ¶
IsCommitUncertain reports whether err means the filesystem mutation may have committed even though a later durability/sync step failed.
func RenameAndSync ¶
RenameAndSync renames old to new and fsyncs the parent directory.
func RenameNoReplaceAndSync ¶
RenameNoReplaceAndSync renames old to new without replacing an existing destination and fsyncs the parent directory.
Types ¶
type CommitUncertainError ¶
CommitUncertainError reports that an operation reached the point where its filesystem mutation may be visible, but a post-commit durability step failed.
func (*CommitUncertainError) Error ¶
func (e *CommitUncertainError) Error() string
func (*CommitUncertainError) Unwrap ¶
func (e *CommitUncertainError) Unwrap() error