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 ¶
- type MemoryQueue
- func (this *MemoryQueue) Close(string) error
- func (this *MemoryQueue) Consume(q *queue.QueueConfig, consumer *queue.ConsumerConfig, offsetStr string) (*queue.Context, []queue.Message, bool, error)
- func (this *MemoryQueue) Depth(q string) int64
- func (this *MemoryQueue) GetQueues() []string
- func (this *MemoryQueue) Init(q string) error
- func (this *MemoryQueue) LatestOffset(string) string
- func (this *MemoryQueue) Name() string
- func (this *MemoryQueue) Pop(q string, t time.Duration) (data []byte, timeout bool)
- func (this *MemoryQueue) Push(q string, data []byte) error
- func (this *MemoryQueue) Setup()
- func (this *MemoryQueue) Start() error
- func (this *MemoryQueue) Stop() error
- type Queue
- func (q *Queue) Back() interface{}
- func (q *Queue) Front() interface{}
- func (q *Queue) Init() *Queue
- func (q *Queue) Len() int
- func (q *Queue) PopBack() interface{}
- func (q *Queue) PopFront() interface{}
- func (q *Queue) PushBack(v interface{})
- func (q *Queue) PushFront(v interface{})
- func (q *Queue) String() string
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) 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 (*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) 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.