ringbuffer

package
v2.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIsEmpty indicate ring buffer is empty.
	ErrIsEmpty = errors.New("ring buffer is empty")
	// ErrIsFull indicate ring buffer is full.
	ErrIsFull = errors.New("ring buffer is full")
)

Functions

This section is empty.

Types

type RingBuffer

type RingBuffer[T any] interface {
	Enqueue(T) error
	Dequeue() (T, error)
	Peak() (T, error)
	Length() int
	Capacity() int
}

RingBuffer is an interface.

func New

func New[T any](capacity int) RingBuffer[T]

NewSpscRingBuffer return the spsc ring buffer with specified capacity.

Jump to

Keyboard shortcuts

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