utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	K = 1024
	M = 1024 * K
	G = 1024 * M
)

Variables

View Source
var (
	LastSizeErr error
)

Functions

func DirUsage

func DirUsage(path string) (size int64, err error)

func Fnv1a

func Fnv1a(buf []byte) (h uint32)

func GetMaxRSS

func GetMaxRSS() int64

func GetStack

func GetStack(bytes int) string

func Getrusage

func Getrusage() syscall.Rusage

func InitSizesForValue

func InitSizesForValue(m reflect.Value) (err error)

func InitSizesPointer

func InitSizesPointer(c interface{}) (err error)

func Remove

func Remove(path string) error

func Rename

func Rename(path, newpath string) error

func SizeToStr

func SizeToStr(n int64) (s string)

func StrToSize

func StrToSize(s string) (n int64)

Types

type Dir

type Dir struct {
	Files map[string]int64
}

func NewDir

func NewDir() *Dir

func (*Dir) CheckPath

func (d *Dir) CheckPath(path string) (d2 *Dir, r1, r2 []File, err error)

func (*Dir) Delete

func (d *Dir) Delete(name string)

func (*Dir) Diff

func (d *Dir) Diff(d2 *Dir) (r1, r2 []File)

func (*Dir) Load

func (d *Dir) Load(path string) (err error)

func (*Dir) Set

func (d *Dir) Set(name string, size int64)

func (*Dir) SetMulti

func (d *Dir) SetMulti(files map[string]int64)

func (*Dir) SetMultiNoSize

func (d *Dir) SetMultiNoSize(files ...string)

func (*Dir) ToSlice

func (d *Dir) ToSlice() []File

type DiskStatus

type DiskStatus struct {
	Root    string
	All     int64
	Used    int64
	Free    int64
	Buckets []int `yaml:",flow"`
}

func DiskUsage

func DiskUsage(path string) (disk DiskStatus, err error)

type File

type File struct {
	Name string
	Size int64
}

type FileList

type FileList []File

func (FileList) Len

func (by FileList) Len() int

func (FileList) Less

func (by FileList) Less(i, j int) bool

func (FileList) Swap

func (by FileList) Swap(i, j int)

type HashMethod

type HashMethod func(v []byte) (h uint32)

Jump to

Keyboard shortcuts

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