bytesqyeye

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BytesQueue

type BytesQueue struct {
	// contains filtered or unexported fields
}

BytesQueue is a non-thead safe queue type of fifo based on bytes array for every push operation index of entry is returned. It can be used to read the entry later

func NewBytesQueue

func NewBytesQueue(capacity int, maxCapacity int, verbose bool) *BytesQueue

NewBytesQueue initializes new bytes queue. capacity is the used in bytes array allocated for queue. When verbose flag is set then information about memory allocation are printed to console

func (*BytesQueue) Capacity

func (q *BytesQueue) Capacity() int

Capacity returns the numbers of allocated bytes for queue

func (*BytesQueue) CheckGet

func (q *BytesQueue) CheckGet(index int) error

CheckGet checks if an entry can be read from index

func (*BytesQueue) Get

func (q *BytesQueue) Get(index int) ([]byte, error)

Get reads entry from index

func (*BytesQueue) Len

func (q *BytesQueue) Len() int

Len returns the number of elements in the queue

func (*BytesQueue) Peek

func (q *BytesQueue) Peek() ([]byte, error)

Peek reads the oldest entry from list without moving head pointer

func (*BytesQueue) Pop

func (q *BytesQueue) Pop() ([]byte, error)

Pop removes the first entry from the queue (FIFO order) and returns its data. It also updates the head pointer and decrements the count of elements. If the head reaches the right margin after popping, it resets the head and potentially the tail to the left margin to maintain ring buffer behavior. This method sets the 'full' flag to false since an element has been removed.

func (*BytesQueue) Push

func (q *BytesQueue) Push(entry []byte) (int, error)

Push copies entry at the end of queue and moves tail pointer. allocates more space if needed. Returns index for pushed data or error if maximum size queue limit is reached

func (*BytesQueue) Reset

func (q *BytesQueue) Reset()

Reset removes all entries from queue

Jump to

Keyboard shortcuts

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