kubernetes/staging/src/k8s.io/apiserver/pkg/server/filters/priority-and-fairness.go

type PriorityAndFairnessClassification

var waitingMark

var (
	atomicMutatingExecuting
	atomicReadOnlyExecuting
)

var (
	atomicMutatingWaiting
	atomicReadOnlyWaiting
)

var newInitializationSignal

func truncateLogField(s string) string {}

var initAPFOnce

type priorityAndFairnessHandler

func (h *priorityAndFairnessHandler) Handle(w http.ResponseWriter, r *http.Request) {}

// WithPriorityAndFairness limits the number of in-flight
// requests in a fine-grained way.
func WithPriorityAndFairness(
	handler http.Handler,
	longRunningRequestCheck apirequest.LongRunningRequestCheck,
	fcIfc utilflowcontrol.Interface,
	workEstimator flowcontrolrequest.WorkEstimatorFunc,
	defaultRequestWaitLimit time.Duration,
) http.Handler {}

// StartPriorityAndFairnessWatermarkMaintenance starts the goroutines to observe and maintain watermarks for
// priority-and-fairness requests.
func StartPriorityAndFairnessWatermarkMaintenance(stopCh <-chan struct{}

func setResponseHeaders(classification *PriorityAndFairnessClassification, w http.ResponseWriter) {}

func tooManyRequests(req *http.Request, w http.ResponseWriter, retryAfter string) {}

// getRequestWaitContext returns a new context with a deadline of how
// long the request is allowed to wait before it is removed from its
// queue and rejected.
// The context.CancelFunc returned must never be nil and the caller is
// responsible for calling the CancelFunc function for cleanup.
//   - ctx: the context associated with the request (it may or may
//     not have a deadline).
//   - defaultRequestWaitLimit: the default wait duration that is used
//     if the request context does not have any deadline.
//     (a) initialization of a watch or
//     (b) a request whose context has no deadline
//
// clock comes in handy for testing the function
func getRequestWaitContext(ctx context.Context, defaultRequestWaitLimit time.Duration, clock utilsclock.PassiveClock) (context.Context, context.CancelFunc) {}