hostlock

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package hostlock provides advisory locking capabilities which can be shared by any process on the same host (or with a shared of the filesystem). This package is currently coupled with BPM concepts but it could be split easily if the need ever arose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handle

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

Handle represents a namespace of locks which is identified by a particular filesystem path.

func NewHandle

func NewHandle(path string) *Handle

NewHandle creates a new Handle from a filesystem path. The path must already exist.

func (*Handle) LockJob

func (h *Handle) LockJob(job, process string) (LockedLock, error)

LockJob places an exclusive advisory lock on a particular BPM job. The LockedLock object it returns can be used to release the lock. Subsequent calls will block until it is released.

func (*Handle) LockVolume

func (h *Handle) LockVolume(path string) (LockedLock, error)

LockVolume places an exclusive advisory lock on a particular BPM volume. The LockedLock object it returns can be used to release the lock. Subsequent calls will block until it is released.

type LockedLock

type LockedLock interface {
	// Unlock can be used to unlock and release the lock to let another
	// consumer acquire the lock.
	Unlock() error
}

LockedLock represents a lock which has been acquired.

Jump to

Keyboard shortcuts

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