Documentation ¶
Index ¶
- func CopyDirectory(srcPath, dstPath string, lock *string) error
- func EnableMmap(off bool)
- func HardLinkFiles(srcDir, dstDir string) error
- func IsDirOrSymlink(fi os.FileInfo) bool
- func IsEmptyDir(path string) bool
- func IsPathExist(path string) bool
- func IsTemporaryFileName(fn string) bool
- func MkdirAllFailIfExist(path string, lock *string) error
- func MkdirAllIfNotExist(path string, lock *string) error
- func MustClose(f fileops.File)
- func MustFileSize(path string) uint64
- func MustGetFreeSpace(path string) uint64
- func MustRemoveAll(path string, lock *string)
- func MustRemoveAllWithDoneCallback(path string, lock *string, done func())
- func MustStopDirRemover()
- func MustSyncPath(path string)
- func MustWriteData(w io.Writer, data []byte)
- func ReadFullData(r io.Reader, data []byte) error
- func RemoveDirContents(dir string, lock *string)
- func SymlinkRelative(srcPath, dstPath string) error
- func WriteFileAtomically(path string, lockPath *string, data []byte) error
- type MustReadAtCloser
- type ReaderAt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDirectory ¶
CopyDirectory copies all the files in srcPath to dstPath.
func HardLinkFiles ¶
HardLinkFiles makes hard links for all the files from srcDir in dstDir.
func IsDirOrSymlink ¶
IsDirOrSymlink returns true if fi is directory or symlink.
func IsEmptyDir ¶
IsEmptyDir returns true if path points to empty directory.
func IsPathExist ¶
IsPathExist returns whether the given path exists.
func IsTemporaryFileName ¶
IsTemporaryFileName returns true if fn matches temporary file name pattern from WriteFileAtomically.
func MkdirAllFailIfExist ¶
MkdirAllFailIfExist creates the given path dir if it isn't exist.
Returns error if path already exists.
func MkdirAllIfNotExist ¶
MkdirAllIfNotExist creates the given path dir if it isn't exist.
func MustFileSize ¶
MustFileSize returns file size for the given path.
func MustGetFreeSpace ¶
MustGetFreeSpace returns free space for the given directory path.
func MustRemoveAll ¶
MustRemoveAll removes path with all the contents.
It properly fsyncs the parent directory after path removal.
It properly handles NFS issue https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61 .
func MustRemoveAllWithDoneCallback ¶
MustRemoveAllWithDoneCallback removes path with all the contents.
It properly fsyncs the parent directory after path removal.
done is called after the path is successfully removed.
done may be called after the function returns for NFS path. See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/61.
func MustStopDirRemover ¶
func MustStopDirRemover()
MustStopDirRemover must be called in the end of graceful shutdown in order to wait for removing the remaining directories from removeDirConcurrencyCh.
It is expected that nobody calls MustRemoveAll when MustStopDirRemover is called.
func ReadFullData ¶
ReadFullData reads len(data) bytes from r.
func RemoveDirContents ¶
RemoveDirContents removes all the contents of the given dir if it exists.
It doesn't remove the dir itself, so the dir may be mounted to a separate partition.
func SymlinkRelative ¶
SymlinkRelative creates relative symlink for srcPath in dstPath.
Types ¶
type MustReadAtCloser ¶
type MustReadAtCloser interface { // MustReadAt must read len(p) bytes from offset off to p. MustReadAt(p []byte, off int64) // MustClose must close the reader. MustClose() }
MustReadAtCloser is rand-access read interface.
type ReaderAt ¶
type ReaderAt struct {
// contains filtered or unexported fields
}
ReaderAt implements rand-access reader.
func MustOpenReaderAt ¶
MustOpenReaderAt opens ReaderAt for reading from filename.
MustClose must be called on the returned ReaderAt when it is no longer needed.
func (*ReaderAt) MustFadviseSequentialRead ¶
MustFadviseSequentialRead hints the OS that f is read mostly sequentially.
if prefetch is set, then the OS is hinted to prefetch f data.
func (*ReaderAt) MustReadAt ¶
MustReadAt reads len(p) bytes at off from r.