apiserverk8s.io/apiserver/pkg/util/flowcontrol/request Index | Files

package request

import "k8s.io/apiserver/pkg/util/flowcontrol/request"

Index

Variables

var (
	// ObjectCountNotFoundErr is returned when the object count for
	// a given resource is not being tracked.
	ObjectCountNotFoundErr = errors.New("object count not found for the given resource")

	// ObjectCountStaleErr is returned when the object count for a
	// given resource has gone stale due to transient failures.
	ObjectCountStaleErr = errors.New("object count has gone stale for the given resource")
)

Types

type StorageObjectCountTracker

type StorageObjectCountTracker interface {
	// Set is invoked to update the current number of total
	// objects for the given resource
	Set(string, int64)

	// Get returns the total number of objects for the given resource.
	// The following errors are returned:
	//  - if the count has gone stale for a given resource due to transient
	//    failures ObjectCountStaleErr is returned.
	//  - if the given resource is not being tracked then
	//    ObjectCountNotFoundErr is returned.
	Get(string) (int64, error)
}

StorageObjectCountTracker is an interface that is used to keep track of of the total number of objects for each resource. {group}.{resource} is used as the key name to update and retrieve the total number of objects for a given resource.

func NewStorageObjectCountTracker

func NewStorageObjectCountTracker(stopCh <-chan struct{}) StorageObjectCountTracker

NewStorageObjectCountTracker returns an instance of StorageObjectCountTracker interface that can be used to keep track of the total number of objects for each resource.

type WorkEstimate

type WorkEstimate struct {
	// Seats represents the number of seats associated with this request
	Seats uint

	// AdditionalLatency specifies the additional duration the seats allocated
	// to this request must be reserved after the given request had finished.
	// AdditionalLatency should not have any impact on the user experience, the
	// caller must not experience this additional latency.
	AdditionalLatency time.Duration
}

type WorkEstimatorFunc

type WorkEstimatorFunc func(*http.Request) WorkEstimate

WorkEstimatorFunc returns the estimated work of a given request. This function will be used by the Priority & Fairness filter to estimate the work of of incoming requests.

func NewWorkEstimator

func NewWorkEstimator(countFn objectCountGetterFunc) WorkEstimatorFunc

NewWorkEstimator estimates the work that will be done by a given request, if no WorkEstimatorFunc matches the given request then the default work estimate of 1 seat is allocated to the request.

func (WorkEstimatorFunc) EstimateWork

func (e WorkEstimatorFunc) EstimateWork(r *http.Request) WorkEstimate

Source Files

list_work_estimator.go object_count_tracker.go width.go

Version
v0.23.0-alpha.1
Published
Aug 19, 2021
Platform
js/wasm
Imports
15 packages
Last checked
14 seconds ago

Tools for package owners.