Documentation ¶
Overview ¶
Package fileutil provides utility methods used when dealing with the filesystem in tsdb. It is largely copied from github.com/coreos/etcd/pkg/fileutil to avoid the dependency chain it brings with it. Please check github.com/coreos/etcd for licensing information.
Index ¶
- func CopyDirs(src, dest string) error
- func Fdatasync(f *os.File) error
- func OpenDir(path string) (*os.File, error)
- func Preallocate(f *os.File, sizeInBytes int64, extendFile bool) error
- func ReadDir(dirpath string) ([]string, error)
- func Rename(from, to string) error
- func Replace(from, to string) error
- type MmapFile
- type Releaser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDirs ¶
CopyDirs copies all directories, subdirectories and files recursively including the empty folders. Source and destination must be full paths.
func Fdatasync ¶
Fdatasync is similar to fsync(), but does not flush modified metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled.
func Preallocate ¶
Preallocate tries to allocate the space for given file. This operation is only supported on linux by a few filesystems (btrfs, ext4, etc.). If the operation is unsupported, no error will be returned. Otherwise, the error encountered will be returned.
Types ¶
type MmapFile ¶
type MmapFile struct {
// contains filtered or unexported fields
}
func OpenMmapFile ¶
type Releaser ¶
type Releaser interface {
Release() error
}
Releaser provides the Release method to release a file lock.
func Flock ¶
Flock locks the file with the provided name. If the file does not exist, it is created. The returned Releaser is used to release the lock. existed is true if the file to lock already existed. A non-nil error is returned if the locking has failed. Neither this function nor the returned Releaser is goroutine-safe.