mem_queue

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Package queue implements a double-ended queue (aka "deque") data structure on top of a slice. All operations run in (amortized) constant time. Benchmarks compare favorably to container/list as well as to Go's channels. These queues are not safe for concurrent use.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryQueue

type MemoryQueue struct {
	Capacity uint32 `config:"capacity"`
	Default  bool   `config:"default"`
	Enabled  bool   `config:"enabled"`

	MemorySize int `config:"total_memory_size"`
	// contains filtered or unexported fields
}

func (*MemoryQueue) Close

func (this *MemoryQueue) Close(string) error

func (*MemoryQueue) Consume

func (this *MemoryQueue) Consume(q *queue.QueueConfig, consumer *queue.ConsumerConfig, offsetStr string) (*queue.Context, []queue.Message, bool, error)

func (*MemoryQueue) Depth

func (this *MemoryQueue) Depth(q string) int64

func (*MemoryQueue) GetQueues

func (this *MemoryQueue) GetQueues() []string

func (*MemoryQueue) Init

func (this *MemoryQueue) Init(q string) error

func (*MemoryQueue) LatestOffset

func (this *MemoryQueue) LatestOffset(string) string

func (*MemoryQueue) Name

func (this *MemoryQueue) Name() string

func (*MemoryQueue) Pop

func (this *MemoryQueue) Pop(q string, t time.Duration) (data []byte, timeout bool)

func (*MemoryQueue) Push

func (this *MemoryQueue) Push(q string, data []byte) error

func (*MemoryQueue) Setup

func (this *MemoryQueue) Setup()

func (*MemoryQueue) Start

func (this *MemoryQueue) Start() error

func (*MemoryQueue) Stop

func (this *MemoryQueue) Stop() error

type Queue

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

Queue represents a double-ended queue. The zero value is an empty queue ready to use.

func New

func New() *Queue

New returns an initialized empty queue.

func (*Queue) Back

func (q *Queue) Back() interface{}

Back returns the last element of queue q or nil.

func (*Queue) Front

func (q *Queue) Front() interface{}

Front returns the first element of queue q or nil.

func (*Queue) Init

func (q *Queue) Init() *Queue

Init initializes or clears queue q.

func (*Queue) Len

func (q *Queue) Len() int

Len returns the number of elements of queue q.

func (*Queue) PopBack

func (q *Queue) PopBack() interface{}

PopBack removes and returns the last element of queue q or nil.

func (*Queue) PopFront

func (q *Queue) PopFront() interface{}

PopFront removes and returns the first element of queue q or nil.

func (*Queue) PushBack

func (q *Queue) PushBack(v interface{})

PushBack inserts a new value v at the back of queue q.

func (*Queue) PushFront

func (q *Queue) PushFront(v interface{})

PushFront inserts a new value v at the front of queue q.

func (*Queue) String

func (q *Queue) String() string

String returns a string representation of queue q formatted from front to back.

Jump to

Keyboard shortcuts

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