util

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GiB                  = 1024 * 1024 * 1024
	TagsDelimiter        = ","
	TagKeyValueDelimiter = "="
)

Variables

This section is empty.

Functions

func BytesToGiB

func BytesToGiB(volumeSizeBytes int64) int64

BytesToGiB conversts Bytes to GiB

func ConvertTagsToMap added in v0.5.0

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

ConvertTagsToMap convert the tags from string to map the valid tags fomat is "key1=value1,key2=value2", which could be converted to {"key1": "value1", "key2": "value2"}

func GiBToBytes

func GiBToBytes(volumeSizeGiB int64) int64

GiBToBytes converts GiB to Bytes

func MakeDir added in v0.8.0

func MakeDir(pathname string) error

func MakeFile added in v0.8.0

func MakeFile(pathname string) error

func RoundUpBytes

func RoundUpBytes(volumeSizeBytes int64) int64

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

func RoundUpGiB

func RoundUpGiB(volumeSizeBytes int64) int64

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

Types

type VolumeLocks added in v1.0.0

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

func NewVolumeLocks added in v1.0.0

func NewVolumeLocks() *VolumeLocks

func (*VolumeLocks) Release added in v1.0.0

func (vl *VolumeLocks) Release(volumeID string)

func (*VolumeLocks) TryAcquire added in v1.0.0

func (vl *VolumeLocks) TryAcquire(volumeID string) bool

Jump to

Keyboard shortcuts

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