Documentation ¶
Index ¶
- type FileLocks
- func (locks *FileLocks) AllocateGivenLock(lck uint32) error
- func (locks *FileLocks) AllocateLock() (uint32, error)
- func (locks *FileLocks) Close() error
- func (locks *FileLocks) DeallocateAllLocks() error
- func (locks *FileLocks) DeallocateLock(lck uint32) error
- func (locks *FileLocks) LockFileLock(lck uint32) error
- func (locks *FileLocks) UnlockFileLock(lck uint32) error
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 ¶
CreateFileLock sets up a directory containing the various lock files.
func OpenFileLock ¶
OpenFileLock opens an existing directory with the lock files.
func (*FileLocks) AllocateGivenLock ¶
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 ¶
AllocateLock allocates a lock and returns the index of the lock that was allocated.
func (*FileLocks) Close ¶
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 ¶
DeallocateAllLocks frees all locks so they can be reallocated to other containers and pods.
func (*FileLocks) DeallocateLock ¶
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 ¶
LockFileLock locks the given lock.
func (*FileLocks) UnlockFileLock ¶
UnlockFileLock unlocks the given lock.