Documentation ¶
Overview ¶
Package queue implements a way for the vault to ensure single-threaded handling of mutexes.
Index ¶
Constants ¶
const MAX_HASH uint16 = 65535
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type QueueLayer ¶
type QueueLayer interface { // Request a Go-routine for the given lock tag. Enqueue(lockTag string, callback func(lockTag string)) }
The vault queue layer interface specifies a way for the vault to obtain a Go-routine for a given lock tag. Once the queue layer notifies the vault, the vault knows that for a given lock tag, it is safe to operate as the thread assigned to that lock tag is the one making the notifying call. The notifying call is made to an entity implementing the Synchronized interface below. One implementor being the vault.
func NewMultiQueue ¶
func NewMultiQueue( concurrency int, capacity int, synchronized Synchronized, ) QueueLayer
Creates a QueueLayer with multiple underlying go routines for quicker dispatch of lock acquisitions and releases. To dispatch, each lock tag is hashed into a number, each queue handles a range.
func NewSingleQueue ¶
func NewSingleQueue( size int, synchronized Synchronized, ) QueueLayer
type SingleQueue ¶
type SingleQueue struct {
// contains filtered or unexported fields
}
func (*SingleQueue) Enqueue ¶
func (singleQueue *SingleQueue) Enqueue(lockTag string, callback func(string))
type Synchronized ¶
type Synchronized interface {
Synchronized(lockTag string, action SynchronizedAction)
}
Interface for calls made by a synchronization thread in the queue layer.
type SynchronizedAction ¶
type SynchronizedAction func(lockTag string)