fifo

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package fifo provides an ownership-safe in-memory first-in, first-out queue for core's internal adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

type Queue[T any] struct {
	// contains filtered or unexported fields
}

Queue owns an ordered collection of values waiting to be taken.

Removing values clears their slots immediately. After a burst recedes, Queue also keeps its backing storage proportional to the live suffix instead of retaining the largest historical backlog. The zero value is ready.

func (*Queue[T]) Clear

func (q *Queue[T]) Clear()

Clear removes every value and releases all storage.

func (*Queue[T]) Len

func (q *Queue[T]) Len() int

Len reports the number of values waiting.

func (*Queue[T]) Pop

func (q *Queue[T]) Pop() (T, bool)

Pop removes and returns the oldest value.

func (*Queue[T]) Push

func (q *Queue[T]) Push(value T)

Push adds value at the end.

func (*Queue[T]) Take

func (q *Queue[T]) Take(limit int) []T

Take removes and returns at most limit oldest values in their original order. The returned slice is owned by the caller and never aliases Queue's storage.

Jump to

Keyboard shortcuts

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