ratelimiter

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 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 RateLimiter

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

RateLimiter is a rate limiter for controllers.

func NewRateLimiter

func NewRateLimiter(
	c client.Client,
	log logr.Logger,
	maxItems int,
	itemIsReady func(context.Context, client.Client, types.NamespacedName, logr.Logger) bool,
	durationToBecomeReady time.Duration,
	logFrequency time.Duration,
	itemPoolingInterval time.Duration,
	itemTimeout time.Duration,
) *RateLimiter

NewRateLimiter creates a new RateLimiter.

func (*RateLimiter) SetupWithManager

func (r *RateLimiter) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager instantiate the RateLimiter, managed by a given manager.

func (*RateLimiter) ShouldReconcile

func (r *RateLimiter) ShouldReconcile(nsName types.NamespacedName) bool

ShouldReconcile check the given item. if the item is ready for reconciliation, ShouldReconcile removes the item from buffer and returns true.

func (*RateLimiter) Start

func (r *RateLimiter) Start(ctx context.Context) error

Start will start the RateLimiter.

Jump to

Keyboard shortcuts

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