workqueue

package
v1.9.0-industry.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 8 more Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CounterMetric

type CounterMetric interface {
	Inc()
}

CounterMetric represents a single numerical value that only ever goes up.

type GaugeMetric

type GaugeMetric interface {
	Inc()
	Dec()
}

GaugeMetric represents a single numerical value that can arbitrarily go up and down.

type GetPriorityFunc

type GetPriorityFunc func(item interface{}) int

type HistogramMetric

type HistogramMetric interface {
	Observe(float64)
}

HistogramMetric counts individual observations.

type MetricsProvider

type MetricsProvider interface {
	NewDepthMetric(name string) GaugeMetric
	NewAddsMetric(name string) CounterMetric
	NewLatencyMetric(name string) HistogramMetric
	NewWorkDurationMetric(name string) HistogramMetric
	NewUnfinishedWorkSecondsMetric(name string) SettableGaugeMetric
	NewLongestRunningProcessorSecondsMetric(name string) SettableGaugeMetric
	NewRetriesMetric(name string) CounterMetric
}

MetricsProvider generates various metrics used by the queue.

type RateLimitingInterface

type RateLimitingInterface interface {
	workqueue.DelayingInterface

	// AddRateLimited adds an item to the workqueue after the rate limiter says it's ok
	AddRateLimited(item interface{})

	// Forget indicates that an item is finished being retried.  Doesn't matter whether it's for perm failing
	// or for success, we'll stop the rate limiter from tracking it.  This only clears the `rateLimiter`, you
	// still have to call `Done` on the queue.
	Forget(item interface{})

	// NumRequeues returns back how many times the item was requeued
	NumRequeues(item interface{}) int
}

RateLimitingInterface is an interface that rate limits items being added to the queue.

func NewNamedRateLimitingQueue

func NewNamedRateLimitingQueue(rateLimiter workqueue.RateLimiter, name string) RateLimitingInterface

func NewNamedRateLimitingWithCustomQueue

func NewNamedRateLimitingWithCustomQueue(rateLimiter workqueue.RateLimiter, queue workqueue.Interface, name string) RateLimitingInterface

func NewRateLimitingQueue

func NewRateLimitingQueue(rateLimiter workqueue.RateLimiter) RateLimitingInterface

NewRateLimitingQueue constructs a new workqueue with rateLimited queuing ability Remember to call Forget! If you don't, you may end up tracking failures forever.

type SettableGaugeMetric

type SettableGaugeMetric interface {
	Set(float64)
}

SettableGaugeMetric represents a single numerical value that can arbitrarily go up and down. (Separate from GaugeMetric to preserve backwards compatibility.)

type SummaryMetric

type SummaryMetric interface {
	Observe(float64)
}

SummaryMetric captures individual observations.

type Type

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

Type is a work queue (see the package comment).

func New

func New() *Type

New constructs a new work queue (see the package comment).

func NewNamed

func NewNamed(name string, maxPriority int, f GetPriorityFunc) *Type

func (*Type) Add

func (q *Type) Add(item interface{})

Add marks item as needing processing.

func (*Type) Done

func (q *Type) Done(item interface{})

Done marks item as done processing, and if it has been marked as dirty again while it was being processed, it will be re-added to the queue for re-processing.

func (*Type) Get

func (q *Type) Get() (item interface{}, shutdown bool)

Get blocks until it can return an item to be processed. If shutdown = true, the caller should end their goroutine. You must call Done with item when you have finished processing it.

func (*Type) Len

func (q *Type) Len() int

Len returns the current queue length, for informational purposes only. You shouldn't e.g. gate a call to Add() or Get() on Len() being a particular value, that can't be synchronized properly.

func (*Type) ShutDown

func (q *Type) ShutDown()

ShutDown will cause q to ignore all new items added to it. As soon as the worker goroutines have drained the existing items in the queue, they will be instructed to exit.

func (*Type) ShuttingDown

func (q *Type) ShuttingDown() bool

Jump to

Keyboard shortcuts

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