queue

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayingQueueStatsd

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

DelayingQueueStatsd is a wrapper around workqueue.DelayingInterface that adds statsd metrics. This is necessary because the workqueue MetricsProvier interface only supports Prometheus metrics, so we need to wrap the DelayedQueue to add statsd metrics.

func NewDelayingQueueStatsd

func NewDelayingQueueStatsd(prefix string) *DelayingQueueStatsd

func (*DelayingQueueStatsd) Add

func (dqs *DelayingQueueStatsd) Add(item interface{})

func (*DelayingQueueStatsd) AddAfter

func (dqs *DelayingQueueStatsd) AddAfter(item interface{}, duration time.Duration)

func (*DelayingQueueStatsd) AddRateLimited added in v0.2.1

func (dqs *DelayingQueueStatsd) AddRateLimited(item interface{})

func (*DelayingQueueStatsd) Done

func (dqs *DelayingQueueStatsd) Done(item interface{})

func (*DelayingQueueStatsd) Forget added in v0.2.1

func (dqs *DelayingQueueStatsd) Forget(item interface{})

func (*DelayingQueueStatsd) Get

func (dqs *DelayingQueueStatsd) Get() (item interface{}, shutdown bool)

func (*DelayingQueueStatsd) Len

func (dqs *DelayingQueueStatsd) Len() int

func (*DelayingQueueStatsd) NumRequeues added in v0.2.1

func (dqs *DelayingQueueStatsd) NumRequeues(item interface{}) int

func (*DelayingQueueStatsd) ShutDown

func (dqs *DelayingQueueStatsd) ShutDown()

func (*DelayingQueueStatsd) ShutDownWithDrain

func (dqs *DelayingQueueStatsd) ShutDownWithDrain()

func (*DelayingQueueStatsd) ShuttingDown

func (dqs *DelayingQueueStatsd) ShuttingDown() bool

type Interface

type Interface interface {
	Add(v interface{}, priority float64)
	Failed(v interface{})
	Forget(v interface{})
	Get() (interface{}, error)
	Len() int
	NumRequeues(v interface{}) int
	Peek(v interface{}) (*Item, error)
}

Interface defines the methods expected on a queue implementation to be functional with the controllers that are present

type Item

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

Item is the items we want to place on the queue we do not want to expose the properties publically so they cannot be altered, the methods attached are read-only for peeking into the queue

func (*Item) Index

func (i *Item) Index() int

Index returns the index

func (*Item) Priority

func (i *Item) Priority() float64

Priority returns the priority

func (*Item) Value

func (i *Item) Value() interface{}

Value returns the value that is present in the item

type Metrics

type Metrics interface {
	// contains filtered or unexported methods
}

Metrics is the interface that needs to be fulfilled to provide a metric implementation to the queue for instrumentation

type NoopMetrics

type NoopMetrics struct {
}

NoopMetrics is an implementation that provides no functionality this is used with the default PriorityQueue construction

func NewNoopMetrics

func NewNoopMetrics() *NoopMetrics

type PriorityQueue

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

PriorityQueue represents the queue

func NewPriorityQueue

func NewPriorityQueue() PriorityQueue

NewPriorityQueue initializes an empty priority queue.

func NewPriorityQueueWithMetrics

func NewPriorityQueueWithMetrics(metrics Metrics) PriorityQueue

NewPriorityQueueWithMetrics allows the type of metric implementation to be pased in to the queue

func (*PriorityQueue) Add

func (p *PriorityQueue) Add(v interface{}, priority float64)

Add inserts a new element into the queue. No action is performed on duplicate elements.

func (*PriorityQueue) Failed

func (p *PriorityQueue) Failed(v interface{})

Failed will document if an item has failed and how many times so it can be used in comparisons for attempts to process

func (*PriorityQueue) Forget

func (p *PriorityQueue) Forget(v interface{})

Forget will remove an item from the failures section and then remove it from the queue

func (*PriorityQueue) Get

func (p *PriorityQueue) Get() (interface{}, error)

Get removes the element with the highest priority from the queue and returns it. In case of an empty queue, an error is returned.

func (*PriorityQueue) Len

func (p *PriorityQueue) Len() int

Len returns the number of elements in the queue.

func (*PriorityQueue) NumRequeues

func (p *PriorityQueue) NumRequeues(v interface{}) int

NumRequeues returns the number of times an item has been pushed through the queue

func (*PriorityQueue) Peek

func (p *PriorityQueue) Peek(v interface{}) (*Item, error)

Peek will allow you to look at an item in the queue without altering the item itself

type StatsdQueueMetrics

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

StatsdQueueMetrics implements the datadog stats provider and fulfills the QueueMetrics interface so we can easily track our queue

func NewStatsdQueueMetrics

func NewStatsdQueueMetrics(client statsd.ClientInterface, prefix string) *StatsdQueueMetrics

Jump to

Keyboard shortcuts

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