file

package
v4.4.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileLocks

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

FileLocks is a struct enabling POSIX lock locking in a shared memory segment.

func CreateFileLock

func CreateFileLock(path string) (*FileLocks, error)

CreateFileLock sets up a directory containing the various lock files.

func OpenFileLock

func OpenFileLock(path string) (*FileLocks, error)

OpenFileLock opens an existing directory with the lock files.

func (*FileLocks) AllocateGivenLock

func (locks *FileLocks) AllocateGivenLock(lck uint32) error

AllocateGivenLock allocates the given lock from the shared-memory segment for use by a container or pod. If the lock is already in use or the index is invalid an error will be returned.

func (*FileLocks) AllocateLock

func (locks *FileLocks) AllocateLock() (uint32, error)

AllocateLock allocates a lock and returns the index of the lock that was allocated.

func (*FileLocks) Close

func (locks *FileLocks) Close() error

Close closes an existing shared-memory segment. The segment will be rendered unusable after closing. WARNING: If you Close() while there are still locks locked, these locks may fail to release, causing a program freeze. Close() is only intended to be used while testing the locks.

func (*FileLocks) DeallocateAllLocks

func (locks *FileLocks) DeallocateAllLocks() error

DeallocateAllLocks frees all locks so they can be reallocated to other containers and pods.

func (*FileLocks) DeallocateLock

func (locks *FileLocks) DeallocateLock(lck uint32) error

DeallocateLock frees a lock in a shared-memory segment so it can be reallocated to another container or pod. The given lock must be already allocated, or an error will be returned.

func (*FileLocks) LockFileLock

func (locks *FileLocks) LockFileLock(lck uint32) error

LockFileLock locks the given lock.

func (*FileLocks) UnlockFileLock

func (locks *FileLocks) UnlockFileLock(lck uint32) error

UnlockFileLock unlocks the given lock.

Jump to

Keyboard shortcuts

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