runtime

package
v0.1.0-rc.15 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ObjectPriorityFn

type ObjectPriorityFn func(client.Object, client.Object) bool

ObjectCompareFn is the signature for any function that can compare the relative priorities of two client.Objects. Implementations MUST return true when the first argument is of higher priority than the second and MUST return false otherwise. Implementors of such functions may safely assume that neither argument can ever be nil.

type PriorityQueue

type PriorityQueue interface {
	// Push adds a copy of the provided client.Object to the priority queue.
	// Implementations MUST disallow pushing nil objects.
	Push(client.Object) error
	// Pop removes the highest priority client.Object from the priority queue and
	// returns it. Implementations MUST return nil if the priority queue is empty.
	Pop() client.Object
	// Depth returns the depth of the PriorityQueue.
	Depth() int
}

PriorityQueue is an interface for any priority queue containing runtime.Objects.

func NewPriorityQueue

func NewPriorityQueue(
	higherFn ObjectPriorityFn,
	objects ...client.Object,
) (PriorityQueue, error)

NewPriorityQueue takes a function for comparing the relative priority of two client.Objects (which MUST return true when the first argument is of higher priority than the second and MUST return false otherwise) and, optionally, any number of client.Objects (which do NOT needs to be pre-ordered) and returns an implementation of the PriorityQueue interface that is safe for concurrent use by multiple goroutines. This function will also return an error if initialized with a nil comparison function or any nil runtime.Objects.

Jump to

Keyboard shortcuts

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