Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropPageCache ¶
DropPageCache us fadvise to tell OS the reclaim memory associated with the file as soon as possible, which can avoid the unexpected I/O latency spike risk.
func IsDirAndWritable ¶
IsDirAndWritable checks a given path is directory and writable
func IsDirReadWritable ¶
IsDirReadWritable check if the dir is writable and readable by cdc server
func IsDirWritable ¶
IsDirWritable checks if a dir is writable, return error nil means it is writable
func PreAllocate ¶
PreAllocate can allocate disk space beforehand in case of ENOSPC error occurs when writing a file, which is not uncommon for a rigorous redolog/WAL design. Besides, pre-allocating disk space can reduce the overhead of file metadata updating.
Types ¶
type DiskInfo ¶
DiskInfo present the disk amount information, in gb
func GetDiskInfo ¶
GetDiskInfo return the disk space information of the given directory the caller should guarantee that dir exist
type FileAllocator ¶
type FileAllocator struct {
// contains filtered or unexported fields
}
FileAllocator has two functionalities:
- create new file or reuse the existing file (the existing tmp file will be cleared) beforehand for file write.
- pre-allocate disk space to mitigate the overhead of file metadata updating.
ref: https://github.com/etcd-io/etcd/pull/4785
func NewFileAllocator ¶
func NewFileAllocator(dir string, prefix string, size int64) *FileAllocator
NewFileAllocator creates a file allocator and starts a background file allocation goroutine.
func (*FileAllocator) Close ¶
func (fl *FileAllocator) Close() error
Close closes the doneCh to notify the background goroutine to exit.
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
FileLock represents a file lock created by `flock`. For more on the system call `flock`, read: https://linux.die.net/man/2/flock
func NewFileLock ¶
NewFileLock creates a new file lock on the file described in filePath.
func (*FileLock) Close ¶
Close closes the underlying file. NOTE: this function will unlock the lock as well.