queue

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryQueue

type MemoryQueue struct {
	Registry *prometheus.Registry
	// contains filtered or unexported fields
}

MemoryQueue is an in-memory FIFO queue implementing the Queue interface

func (*MemoryQueue) Dequeue

func (q *MemoryQueue) Dequeue() interface{}

Dequeue removes and returns the left most item in the queue

func (*MemoryQueue) Empty

func (q *MemoryQueue) Empty() bool

Empty returns true if the queue is empty; false otherwise

func (*MemoryQueue) Enqueue

func (q *MemoryQueue) Enqueue(item interface{})

Enqueue adds a new item to the queue

func (*MemoryQueue) Head

func (q *MemoryQueue) Head() interface{}

Head returns the left most item in the queue but does not change the queue

func (*MemoryQueue) Init

func (q *MemoryQueue) Init() bool

Init initializes a new in memory queue

func (*MemoryQueue) Size

func (q *MemoryQueue) Size() int

Size returns the approximate number of elements in the queue

type Queue

type Queue interface {
	Enqueue(interface{})
	Dequeue() interface{}
	Size() int
	Empty() bool
	Head() interface{}
	Init() bool
}

Queue generic queue interface

type RedisQueue

type RedisQueue struct {
	Registry *prometheus.Registry
	Server   string
	// contains filtered or unexported fields
}

RedisQueue is a distributed FIFO queue using Redis

func (*RedisQueue) Dequeue

func (q *RedisQueue) Dequeue() interface{}

Dequeue pop the tail off the queue and returns it

func (*RedisQueue) Empty

func (q *RedisQueue) Empty() bool

Empty returns true if the queue is empty

func (*RedisQueue) Enqueue

func (q *RedisQueue) Enqueue(item interface{})

Enqueue adds a new item to the queue

func (*RedisQueue) Head

func (q *RedisQueue) Head() interface{}

Head returns the left most item in the queue without modifying the queue

func (*RedisQueue) Init

func (q *RedisQueue) Init() bool

Init initializes a new RedisQueue

func (*RedisQueue) Size

func (q *RedisQueue) Size() int

Size returns the approximate number of elements in the queue

Jump to

Keyboard shortcuts

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