fsutil

package
v0.0.0-...-a345a4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDirAndWritable

func IsDirAndWritable(path string) error

IsDirAndWritable checks a given path is directory and writable

func IsDirReadWritable

func IsDirReadWritable(dir string) error

IsDirReadWritable check if the dir is writable and readable by cdc server

func IsDirWritable

func IsDirWritable(dir string) error

IsDirWritable checks if a dir is writable, return error nil means it is writable

Types

type DiskInfo

type DiskInfo struct {
	All             uint64
	Used            uint64
	Free            uint64
	Avail           uint64
	AvailPercentage float32
}

DiskInfo present the disk amount information, in gb

func GetDiskInfo

func GetDiskInfo(dir string) (*DiskInfo, error)

GetDiskInfo return the disk space information of the given directory the caller should guarantee that dir exist

func (*DiskInfo) String

func (d *DiskInfo) String() string

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

func NewFileLock(filePath string) (*FileLock, error)

NewFileLock creates a new file lock on the file described in filePath.

func (*FileLock) Close

func (fl *FileLock) Close() error

Close closes the underlying file. NOTE: this function will unlock the lock as well.

func (*FileLock) IsLocked

func (fl *FileLock) IsLocked() (bool, error)

IsLocked checks whether the file is currently locked

func (*FileLock) Lock

func (fl *FileLock) Lock() error

Lock places a lock on the file

func (*FileLock) Unlock

func (fl *FileLock) Unlock() error

Unlock unlocks the file lock

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL