util

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package util is a generated GoMock package.

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 GetKubeClient added in v1.23.3

func GetKubeClient(kubeconfig string, kubeAPIQPS float64, kubeAPIBurst int, userAgent string) (kubernetes.Interface, 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 SetVolumeOwnership added in v1.24.0

func SetVolumeOwnership(path, gid, policy string) error

SetVolumeOwnership would set gid for path recursively

func TrimDuplicatedSpace added in v1.19.5

func TrimDuplicatedSpace(s string) string

func WaitUntilTimeout added in v1.23.7

func WaitUntilTimeout(timeout time.Duration, execFunc ExecFunc, timeoutFunc TimeoutFunc) error

WaitUntilTimeout waits for the exec function to complete or return timeout error

Types

type Azcopy added in v1.23.2

type Azcopy struct {
	ExecCmd EXEC
}

func (*Azcopy) GetAzcopyJob added in v1.23.2

func (ac *Azcopy) GetAzcopyJob(dstBlobContainer string, authAzcopyEnv []string) (AzcopyJobState, string, error)

GetAzcopyJob get the azcopy job status if job existed

func (*Azcopy) TestListJobs added in v1.23.3

func (ac *Azcopy) TestListJobs(accountName, storageEndpointSuffix string, authAzcopyEnv []string) (string, error)

TestListJobs test azcopy jobs list command with authAzcopyEnv

type AzcopyJobState added in v1.23.2

type AzcopyJobState string
const (
	AzcopyJobError     AzcopyJobState = "Error"
	AzcopyJobNotFound  AzcopyJobState = "NotFound"
	AzcopyJobRunning   AzcopyJobState = "Running"
	AzcopyJobCompleted AzcopyJobState = "Completed"
)

type EXEC added in v1.23.2

type EXEC interface {
	RunCommand(string, []string) (string, error)
}

type ExecCommand added in v1.23.2

type ExecCommand struct {
}

func (*ExecCommand) RunCommand added in v1.23.2

func (ec *ExecCommand) RunCommand(cmdStr string, authEnv []string) (string, error)

type ExecFunc added in v1.23.7

type ExecFunc func() (err error)

ExecFunc returns a exec function's output and error

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 MockEXEC added in v1.23.2

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

MockEXEC is a mock of EXEC interface.

func NewMockEXEC added in v1.23.2

func NewMockEXEC(ctrl *gomock.Controller) *MockEXEC

NewMockEXEC creates a new mock instance.

func (*MockEXEC) EXPECT added in v1.23.2

func (m *MockEXEC) EXPECT() *MockEXECMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEXEC) RunCommand added in v1.23.2

func (m *MockEXEC) RunCommand(arg0 string, arg1 []string) (string, error)

RunCommand mocks base method.

type MockEXECMockRecorder added in v1.23.2

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

MockEXECMockRecorder is the mock recorder for MockEXEC.

func (*MockEXECMockRecorder) RunCommand added in v1.23.2

func (mr *MockEXECMockRecorder) RunCommand(arg0, arg1 interface{}) *gomock.Call

RunCommand indicates an expected call of RunCommand.

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)

type TimeoutFunc added in v1.23.7

type TimeoutFunc func() (err error)

TimeoutFunc returns output and error if an ExecFunc timeout

type VolumeMounter added in v1.24.0

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

func (*VolumeMounter) CanMount added in v1.24.0

func (l *VolumeMounter) CanMount() error

func (*VolumeMounter) GetAttributes added in v1.24.0

func (l *VolumeMounter) GetAttributes() volume.Attributes

func (*VolumeMounter) GetMetrics added in v1.24.0

func (l *VolumeMounter) GetMetrics() (*volume.Metrics, error)

func (*VolumeMounter) GetPath added in v1.24.0

func (l *VolumeMounter) GetPath() string

func (*VolumeMounter) SetUp added in v1.24.0

func (l *VolumeMounter) SetUp(_ volume.MounterArgs) error

func (*VolumeMounter) SetUpAt added in v1.24.0

func (l *VolumeMounter) SetUpAt(_ string, _ volume.MounterArgs) error

Jump to

Keyboard shortcuts

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