util

package
v0.0.0-...-ed02bd6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// VolumeOperationAlreadyExistsFmt string format to return for concerrent operation
	VolumeOperationAlreadyExistsFmt = "an operation with the given Volume ID %s already exists"

	// VolumeOperationAlreadyExistsFmt string format to return for concerrent operation
	SnapshotOperationAlreadyExistsFmt = "an operation with the given Snapshot ID %s already exists"
)

Variables

View Source
var (
	BuildTime string
	GitCommit string
	Version   string
)

Functions

func EnableProfiling

func EnableProfiling()

EnableProfiling enables golang profiling.

func ExecCommand

func ExecCommand(command string, args []string) ([]byte, error)

func ExecCommandHost

func ExecCommandHost(command string, args []string) ([]byte, error)

func GetVersion

func GetVersion() string

func HttpGet

func HttpGet(reqURL string, queryMap map[string]string) (int, []byte, error)

func IsNotFoundErr

func IsNotFoundErr(err error, id ...string) bool

func StringFlagPutHandler

func StringFlagPutHandler(setter StringFlagSetterFunc) http.HandlerFunc

StringFlagPutHandler wraps an http Handler to set string type flag.

func SystemMapOnHost

func SystemMapOnHost(ctx context.Context, serviceName string, mapCommands []string) (err error)

func ValidateDriverName

func ValidateDriverName(driverName string) error

ValidateDriverName validates the driver name

Types

type DeviceStats

type DeviceStats struct {
	Block bool

	AvailableBytes  int64
	TotalBytes      int64
	UsedBytes       int64
	AvailableInodes int64
	TotalInodes     int64
	UsedInodes      int64
}

func GetDeviceStats

func GetDeviceStats(path string) (*DeviceStats, error)

type NotFoundErr

type NotFoundErr struct {
	Id string
}

func NewNotFoundErr

func NewNotFoundErr(id ...string) *NotFoundErr

func (*NotFoundErr) Error

func (e *NotFoundErr) Error() string

type ResizeFs

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

func NewResizeFs

func NewResizeFs(mounter *mount.SafeFormatAndMount) *ResizeFs

func (*ResizeFs) Resize

func (resizefs *ResizeFs) Resize(ctx context.Context, devicePath string, deviceMountPath string) (bool, error)

Resize perform resize of file system

type StringFlagSetterFunc

type StringFlagSetterFunc func(string) (string, error)

type VolumeLocks

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

VolumeLocks implements a map with atomic operations. It stores a set of all volume IDs with an ongoing operation.

func NewVolumeLocks

func NewVolumeLocks() *VolumeLocks

NewVolumeLocks returns new VolumeLocks

func (*VolumeLocks) Release

func (vl *VolumeLocks) Release(volumeID string)

func (*VolumeLocks) TryAcquire

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

TryAcquire tries to acquire the lock for operating on volumeID and returns true if successful. If another operation is already using volumeID, returns false.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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