util

package
v1.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	Mb = 1024 * 1024
)
View Source
const (
	VolumeOperationAlreadyExistsFmt = "An operation with the given volume key %s already exists"
)

Variables

This section is empty.

Functions

func ConvertLabelsStringToMap

func ConvertLabelsStringToMap(labels string) (map[string]string, error)

ConvertLabelsStringToMap converts the labels from string to map example: "key1=value1,key2=value2" gets converted into {"key1": "value1", "key2": "value2"}

func ParseEndpoint

func ParseEndpoint(endpoint string, cleanupSocket bool) (string, string, error)

func ParsePodIDVolumeFromTargetpath

func ParsePodIDVolumeFromTargetpath(targetPath string) (string, string, error)

func PrepareEmptyDir

func PrepareEmptyDir(targetPath string, createEmptyDir bool) (string, error)

func RecvMsg

func RecvMsg(via net.Conn) (int, []byte, error)

func SendMsg

func SendMsg(via net.Conn, fd int, msg []byte) error

Types

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

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.

Jump to

Keyboard shortcuts

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