fsutils

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const FlagRead = 0x1
View Source
const FlagWrite = 0x2

Variables

View Source
var (
	DiskSpeed   = SpeedLow
	DiskSpeedMB float64
)
View Source
var IsInExtremelyHighLoad = false
View Source
var IsInHighLoad = false
View Source
var ReaderLimiter = NewLimiter(max(maxThreads, 8))
View Source
var WriterLimiter = NewLimiter(max(maxThreads, 8))

Functions

func CheckDiskIsFast added in v1.2.5

func CheckDiskIsFast() (speedMB float64, isFast bool, err error)

CheckDiskIsFast check disk is 'fast' disk to write

func CheckDiskWritingSpeed added in v1.2.5

func CheckDiskWritingSpeed() (speedMB float64, err error)

CheckDiskWritingSpeed test disk writing speed

func DiskIsExtremelyFast added in v1.2.7

func DiskIsExtremelyFast() bool

func DiskIsFast added in v1.2.7

func DiskIsFast() bool

func Open added in v1.3.8

func Open(name string) (f *os.File, err error)

func OpenFile added in v1.3.8

func OpenFile(name string, flag int, perm os.FileMode) (f *os.File, err error)

func ReadFile added in v1.3.7

func ReadFile(filename string) (data []byte, err error)

func Remove added in v1.3.7

func Remove(filename string) (err error)

func Rename added in v1.3.7

func Rename(oldPath string, newPath string) (err error)

func WaitLoad added in v1.3.5

func WaitLoad(maxLoad float64, maxLoops int, delay time.Duration)

WaitLoad wait system load to downgrade

func WriteFile added in v1.3.7

func WriteFile(filename string, data []byte, perm os.FileMode) (err error)

Types

type DiskSpeedCache added in v1.2.10

type DiskSpeedCache struct {
	Speed   Speed   `json:"speed"`
	SpeedMB float64 `json:"speedMB"`
}

type File added in v1.3.8

type File struct {
	// contains filtered or unexported fields
}

func NewFile added in v1.3.8

func NewFile(rawFile *os.File, flags int) *File

func (*File) Close added in v1.3.8

func (this *File) Close() (err error)

func (*File) Fd added in v1.3.8

func (this *File) Fd() uintptr

func (*File) Name added in v1.3.8

func (this *File) Name() string

func (*File) Raw added in v1.3.8

func (this *File) Raw() *os.File

func (*File) Read added in v1.3.8

func (this *File) Read(b []byte) (n int, err error)

func (*File) ReadAt added in v1.3.8

func (this *File) ReadAt(b []byte, off int64) (n int, err error)

func (*File) Seek added in v1.3.8

func (this *File) Seek(offset int64, whence int) (ret int64, err error)

func (*File) Stat added in v1.3.8

func (this *File) Stat() (os.FileInfo, error)

func (*File) Sync added in v1.3.8

func (this *File) Sync() (err error)

func (*File) Truncate added in v1.3.8

func (this *File) Truncate(size int64) (err error)

func (*File) Write added in v1.3.8

func (this *File) Write(b []byte) (n int, err error)

func (*File) WriteAt added in v1.3.8

func (this *File) WriteAt(b []byte, off int64) (n int, err error)

type Limiter added in v1.3.7

type Limiter struct {
	// contains filtered or unexported fields
}

func NewLimiter added in v1.3.7

func NewLimiter(threads int) *Limiter

func (*Limiter) Ack added in v1.3.7

func (this *Limiter) Ack()

func (*Limiter) FreeThreads added in v1.3.7

func (this *Limiter) FreeThreads() int

func (*Limiter) Release added in v1.3.7

func (this *Limiter) Release()

func (*Limiter) SetThreads added in v1.3.8

func (this *Limiter) SetThreads(newThreads int)

func (*Limiter) TryAck added in v1.3.7

func (this *Limiter) TryAck() bool

type Locker added in v1.2.7

type Locker struct {
	// contains filtered or unexported fields
}

func NewLocker added in v1.2.7

func NewLocker(path string) *Locker

func (*Locker) Lock added in v1.2.7

func (this *Locker) Lock() error

func (*Locker) Release added in v1.2.7

func (this *Locker) Release() error

func (*Locker) TryLock added in v1.2.7

func (this *Locker) TryLock() (ok bool, err error)

type Speed added in v1.2.7

type Speed int
const (
	SpeedExtremelyFast Speed = 1
	SpeedFast          Speed = 2
	SpeedLow           Speed = 3
	SpeedExtremelySlow Speed = 4
)

func (Speed) String added in v1.2.7

func (this Speed) String() string

type StatResult

type StatResult struct {
	// contains filtered or unexported fields
}

func NewStatResult

func NewStatResult(rawStat *unix.Statfs_t) *StatResult

func StatDevice added in v1.2.9

func StatDevice(path string) (*StatResult, error)

StatDevice device contains the path

func StatDeviceCache added in v1.2.9

func StatDeviceCache(path string) (*StatResult, error)

StatDeviceCache stat device with cache

func (*StatResult) FreeSize

func (this *StatResult) FreeSize() uint64

func (*StatResult) TotalSize

func (this *StatResult) TotalSize() uint64

func (*StatResult) UsedSize

func (this *StatResult) UsedSize() uint64

Jump to

Keyboard shortcuts

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