package
0.0.0-20240904210011-3474b320e3bf
Repository: https://github.com/cockroachdb/crlib.git
Documentation: pkg.go.dev

# README

Go facilities for FIFO queueing

This library contains several optimized facilities related to FIFO queueing and rate limiting.

  • Queue implements an allocation efficient FIFO queue.

  • Semaphore implements a weighted, dynamically reconfigurable semaphore which respects context cancellation.

TODO(radu): add rate limiter.

# Functions

MakeQueue constructs a new Queue.
MakeQueueBackingPool makes a queue backing pool.
NewSemaphore creates a new semaphore with the given capacity.

# Variables

ErrRequestExceedsCapacity is returned when an Acquire requests more than the current capacity of the semaphore.

# Structs

Queue implements an allocation efficient FIFO queue.
QueueBackingPool is a sync.Pool that used to allocate internal nodes for Queue[T].
Semaphore implements a weighted, dynamically reconfigurable semaphore which respects context cancellation.
SemaphoreStats contains information about the current state of the semaphore.