priorityqueue

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddOpts

type AddOpts struct {
	After       time.Duration
	RateLimited bool
	Priority    int
}

AddOpts describes the options for adding items to the queue.

type Opt

type Opt[T comparable] func(*Opts[T])

Opt allows to configure a PriorityQueue.

type Opts

type Opts[T comparable] struct {
	// Ratelimiter is being used when AddRateLimited is called. Defaults to a per-item exponential backoff
	// limiter with an initial delay of five milliseconds and a max delay of 1000 seconds.
	RateLimiter    workqueue.TypedRateLimiter[T]
	MetricProvider workqueue.MetricsProvider
}

Opts contains the options for a PriorityQueue.

type PriorityQueue

type PriorityQueue[T comparable] interface {
	workqueue.TypedRateLimitingInterface[T]
	AddWithOpts(o AddOpts, Items ...T)
	GetWithPriority() (item T, priority int, shutdown bool)
}

PriorityQueue is a priority queue for a controller. It internally de-duplicates all items that are added to it. It will use the max of the passed priorities and the min of possible durations.

func New

func New[T comparable](name string, o ...Opt[T]) PriorityQueue[T]

New constructs a new PriorityQueue.

Jump to

Keyboard shortcuts

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