controller-runtimesigs.k8s.io/controller-runtime/pkg/controller/priorityqueue Index | Files

package priorityqueue

import "sigs.k8s.io/controller-runtime/pkg/controller/priorityqueue"

Index

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
	Log            logr.Logger
}

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.

Source Files

metrics.go priorityqueue.go

Version
v0.21.0 (latest)
Published
May 20, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
25 minutes ago

Tools for package owners.