ringbuffer

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New[Value any](opts ...options.Option[core.Options]) core.Queue[Value]

New creates a new RingBuffer

Types

type RingBuffer

type RingBuffer[Value any] struct {
	// contains filtered or unexported fields
}

RingBuffer is a lock-free queue implementation based on a ring buffer.

func (*RingBuffer[Value]) Dequeue

func (rb *RingBuffer[Value]) Dequeue() (Value, bool)

Pop reads the next item in the buffer. We retry in case of some conflict with other goroutine.

func (*RingBuffer[Value]) Empty

func (rb *RingBuffer[Value]) Empty() bool

func (*RingBuffer[Value]) Enqueue

func (rb *RingBuffer[Value]) Enqueue(v Value) bool

Push adds a new item to the buffer. We revert changes and retry in case of some conflict with other goroutine.

func (*RingBuffer[Value]) Full

func (rb *RingBuffer[Value]) Full() bool

func (*RingBuffer[Value]) Size

func (rb *RingBuffer[Value]) Size() int

Jump to

Keyboard shortcuts

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