utils

package
v0.0.0-...-f34f863 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeOperationAlreadyExistsFmt = "An operation with the given Volume ID %s already exists"
)

Variables

View Source
var ErrNoDevice = errors.New("can't find device")

Functions

func BindMount

func BindMount(source, destination string, readOnly bool, mounter mount.Interface) error

func GetDeviceFromMount

func GetDeviceFromMount(mounter mount.Interface, mountPath string) (string, error)

func GetDeviceFromPath

func GetDeviceFromPath(mountPath string) (string, error)

GetDeviceNameFromMount given a mnt point, find the device from /proc/mounts returns the device name, reference count, and error code.

func ListenerFromUrl

func ListenerFromUrl(ctx context.Context, endpoint string) (net.Listener, 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