queue

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: MIT Imports: 3 Imported by: 0

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 Layer added in v0.5.3

type Layer interface {
	// Request a Go-routine for the given lock tag.
	Enqueue(lockTag string, action func(slot int, lockTag string))
}

Layer is an interface that 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,
) Layer

NewMultiQueue 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,
) Layer

type SingleQueue

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

func (*SingleQueue) Enqueue

func (singleQueue *SingleQueue) Enqueue(lockTag string, action func(int, string))

Jump to

Keyboard shortcuts

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