Documentation
¶
Overview ¶
Package queue implements a way for the vault to ensure single-threaded handling of mutexes.
Index ¶
Constants ¶
View Source
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, action func(slot int, 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 to the provided callback.
func NewMultiQueue ¶
func NewMultiQueue( concurrency int, capacity int, ) 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, ) QueueLayer
type SingleQueue ¶
type SingleQueue struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.