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
Click to show internal directories.
Click to hide internal directories.