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-thread 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(initialCapacity int, verbose bool) *BytesQueue
NewBytesQueue initialize new bytes queue. Initial capacity is used in bytes array allocation When verbose flag is set then information about memory allocation are printed
func (*BytesQueue) Capacity ¶
func (q *BytesQueue) Capacity() int
Capacity returns number of allocated bytes for queue
func (*BytesQueue) Get ¶
func (q *BytesQueue) Get(index int) ([]byte, error)
Get reads entry from index
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 reads the oldest entry from queue and moves head pointer to the next one
func (*BytesQueue) Push ¶
func (q *BytesQueue) Push(data []byte) int
Push copies entry at the end of queue and moves tail pointer. Allocates more space if needed. Returns index for pushed data