applier

package
v0.2.1 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: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyFunc

type ApplyFunc func(key string) error

ApplyFunc is a func that needs to be applied on seeing a particular key be passed to an Applyinator

type Applyinator

type Applyinator interface {
	Apply(key string)
	Run(ctx context.Context, workers int)
}

Applyinator is an interface that eventually ensures that a requested action, identified by some key, is applied. Any object that implements Applyinator should provide the same guarantees as the k8s.io/client-go/util/workqueue implementation, namely:

* Fair: items processed in the order in which they are added. * Stingy: a single item will not be processed multiple times concurrently, and if an item is added multiple times before it can be processed, it will only be processed once. * Multiple consumers and producers. In particular, it is allowed for an item to be reenqueued while it is being processed.

func NewApplyinator

func NewApplyinator(name string, applyFunc ApplyFunc, opts *Options) Applyinator

NewApplyinator allows you to register a function that applies an action based on whether a particular key is enqueued via a call to Apply. It implements k8s.io/client-go/util/workqueue under the hood, which allows us to ensure that the apply function is called with the following guarantees (provided by workqueues):

* Fair: items processed in the order in which they are added. * Stingy: a single item will not be processed multiple times concurrently, and if an item is added multiple times before it can be processed, it will only be processed once. * Multiple consumers and producers. In particular, it is allowed for an item to be reenqueued while it is being processed.

type Options

type Options struct {
	RateLimiter workqueue.RateLimiter
}

Options are options that can be specified to configure a desired Applyinator

Jump to

Keyboard shortcuts

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