linkedbuffer

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEOF = errors.New("EOF")

Functions

This section is empty.

Types

type LinkedBuffer

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

LinkedBuffer implements an unbounded generic buffer that can be written to and read from concurrently. It is implemented using a linked list of buffers.

func NewLinkedBuffer

func NewLinkedBuffer[T any](initialCapacity, maxCapacity int) *LinkedBuffer[T]

func (*LinkedBuffer[T]) Len

func (b *LinkedBuffer[T]) Len() uint64

Len returns the number of elements in the buffer that haven't yet been read

func (*LinkedBuffer[T]) Read

func (b *LinkedBuffer[T]) Read() (value T, err error)

Read reads values from the buffer and returns the number of elements read

func (*LinkedBuffer[T]) ReadCount

func (b *LinkedBuffer[T]) ReadCount() uint64

ReadCount returns the number of elements read from the buffer since it was created

func (*LinkedBuffer[T]) Write

func (b *LinkedBuffer[T]) Write(value T)

Write writes values to the buffer

func (*LinkedBuffer[T]) WriteCount

func (b *LinkedBuffer[T]) WriteCount() uint64

WriteCount returns the number of elements written to the buffer since it was created

Jump to

Keyboard shortcuts

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