util

package
v1.2.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSharedContextEvaluator

func NewSharedContextEvaluator(
	name string,
	groupKind unversioned.GroupKind,
	operationResources map[admission.Operation][]kapi.ResourceName,
	matchedResourceNames []kapi.ResourceName,
	matchesScopeFunc generic.MatchesScopeFunc,
	getFuncByNamespace generic.GetFuncByNamespace,
	listFuncByNamespace generic.ListFuncByNamespace,
	constraintsFunc generic.ConstraintsFunc,
	usageComputerFactory UsageComputerFactory,
) quota.Evaluator

NewSharedContextEvaluator creates an evaluator object that allows to share context while computing usage of single namespace. Context is represented by an object returned by usageComputerFactory and is destroyed when the namespace is processed.

Types

type SharedContextEvaluator

type SharedContextEvaluator struct {
	*generic.GenericEvaluator
	UsageComputerFactory UsageComputerFactory
}

SharedContextEvaluator provides an implementation for quota.Evaluator

func (*SharedContextEvaluator) Usage

Usage evaluates usage of given object.

func (*SharedContextEvaluator) UsageStats

UsageStats calculates latest observed usage stats for all objects. UsageComputerFactory is used to create a UsageComputer object whose Usage is called on every object in a namespace.

type UsageComputer

type UsageComputer interface {
	Usage(object runtime.Object) kapi.ResourceList
}

UsageComputer knows how to measure usage associated with an object. Its implementation can store arbitrary data during `Usage()` run as a context while namespace is being evaluated.

type UsageComputerFactory

type UsageComputerFactory func() UsageComputer

UsageComputerFactory returns a usage computer used during namespace evaluation.

Jump to

Keyboard shortcuts

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