util

package
v1.21.5 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GiB = 1024 * 1024 * 1024
	TiB = 1024 * GiB
)

Variables

This section is empty.

Functions

func BytesToGiB

func BytesToGiB(volumeSizeBytes int64) int64

BytesToGiB conversts Bytes to GiB

func ConvertTagsToMap added in v1.2.0

func ConvertTagsToMap(tags string) (map[string]string, error)

func GetMountOptions

func GetMountOptions(options []string) string

GetMountOptions return options with string list separated by space

func GiBToBytes

func GiBToBytes(volumeSizeGiB int64) int64

GiBToBytes converts GiB to Bytes

func MakeDir added in v0.7.0

func MakeDir(pathname string, perm os.FileMode) error

func RoundUpBytes

func RoundUpBytes(volumeSizeBytes int64) int64

RoundUpBytes rounds up the volume size in bytes up to multiplications of GiB in the unit of Bytes

func RoundUpGiB

func RoundUpGiB(volumeSizeBytes int64) int64

RoundUpGiB rounds up the volume size in bytes up to multiplications of GiB in the unit of GiB

func TrimDuplicatedSpace added in v1.19.5

func TrimDuplicatedSpace(s string) string

Types

type LockMap added in v0.9.0

type LockMap struct {
	sync.Mutex
	// contains filtered or unexported fields
}

LockMap used to lock on entries

func NewLockMap added in v0.9.0

func NewLockMap() *LockMap

NewLockMap returns a new lock map

func (*LockMap) LockEntry added in v0.9.0

func (lm *LockMap) LockEntry(entry string)

LockEntry acquires a lock associated with the specific entry

func (*LockMap) UnlockEntry added in v0.9.0

func (lm *LockMap) UnlockEntry(entry string)

UnlockEntry release the lock associated with the specific entry

type OsInfo added in v1.18.0

type OsInfo struct {
	Distro  string
	Version string
}

func GetOSInfo added in v1.18.0

func GetOSInfo(f interface{}) (*OsInfo, error)

Jump to

Keyboard shortcuts

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