Documentation
¶
Overview ¶
Package vault solves the handling of mutexes.
Index ¶
Constants ¶
View Source
const ( LOCKED lockState = true UNLOCKED lockState = false )
Variables ¶
View Source
var ( ErrUnnecessaryAcquire = errors.New( "client tried to acquire a lock that it already had acquired", ) ErrUnnecessaryRelease = errors.New( "client tried to release a lock that had not been acquired", ) ErrBadManners = errors.New( "client tried to release lock that it did not own", ) )
Functions ¶
This section is empty.
Types ¶
type Vault ¶
type Vault interface {
// Lock tag is a string identifying the lock to acquire, client the requesting party,
// and the callback a function which will be called to either confirm acquisition or
// including an error in case the client is misbehaving. The callback may return an
// error in case feedback handling encounters an error.
Acquire(lockTag string, client string, callback func(error) error)
Release(lockTag string, client string, callback func(error) error)
Cleanup(client string)
}
The Vault interface specifies high level functions to implement in order to handle the acquisition and release of mutexes.
func NewVault ¶
func NewVault(options *VaultOptions) Vault
type VaultOptions ¶
type VaultOptions struct {
// Single queue mode should only be used for testing.
QueueType
// Only for multi-mode queues, determines the number of
// supporting Go-routines able to handle work given to the
// queueing layer.
QueueConcurrency int
// Sets the capacity of the underlying queue(s), the max amount
// of buffered work for a queue. In a multi queue setting, the
// capacity indicates the buffer size per queue.
QueueCapacity int
}
Click to show internal directories.
Click to hide internal directories.