Documentation
¶
Index ¶
- type BytesQueue
- func (q *BytesQueue) Capacity() int
- func (q *BytesQueue) CheckGet(index int) error
- func (q *BytesQueue) Get(index int) ([]byte, error)
- func (q *BytesQueue) Len() int
- func (q *BytesQueue) Peek() ([]byte, error)
- func (q *BytesQueue) Pop() ([]byte, error)
- func (q *BytesQueue) Push(entry []byte) (int, error)
- func (q *BytesQueue) Reset()
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.