Documentation ¶
Index ¶
- Variables
- func Exists(file string) bool
- func Getxattr(fileNameOrFd interface{}, attr string, value []byte) (int, error)
- func Inode(file string) (uint64, error)
- func IsMount(dir string) (bool, error)
- func IsNotDir(err error) bool
- func LockPath(directory string, timeout time.Duration) (*os.File, error)
- func ReadDirNames(path string) ([]string, error)
- func Setxattr(fileNameOrFd interface{}, attr string, value []byte) (int, error)
- type AtomicFileWriter
- type TempFile
Constants ¶
This section is empty.
Variables ¶
View Source
var ( AT_FDCWD = C.AT_FDCWD AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW O_TMPFILE = C.__O_TMPFILE | syscall.O_DIRECTORY )
Functions ¶
func Getxattr ¶
Getxattr gets xattrs from a file, given a filename(string) or file descriptor(uintptr), an attribute name, and value buffer to store it to.
func ReadDirNames ¶
Types ¶
type AtomicFileWriter ¶
type AtomicFileWriter interface { // Write writes the data to the underlying file. Write([]byte) (int, error) // Fd returns the file's underlying file descriptor. Fd() uintptr // Save atomically writes the file to its destination. Save(string) error // Abandon removes any resources associated with this file. Abandon() error // Preallocate pre-allocates space on disk, given the expected file size and disk reserve size. Preallocate(int64, int64) error // syncs file to disk (1st half of Save) Sync() error // links synced file to correct place in filesystem (2nd half of Save) Finalize(string) error }
AtomicFileWriter saves a new file atomically.
func NewAtomicFileWriter ¶
func NewAtomicFileWriter(tempDir string, dstDir string) (AtomicFileWriter, error)
NewAtomicFileWriter returns an AtomicFileWriter, which handles atomically writing files.
type TempFile ¶
TempFile implements an atomic file writer using linux's O_TMPFILE/linkat mechanism if available, otherwise by writing to a temp directory and renaming.
func (*TempFile) Abandon ¶
Abandon removes any resources associated with this file, if it hasn't already been saved.
func (*TempFile) Preallocate ¶
Preallocate pre-allocates space for the file.
Click to show internal directories.
Click to hide internal directories.