iface

package
v0.5.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComponentID

func ComponentID(component Component) string

ComponentID returns the ID for a component.

func ComponentIDExpanded

func ComponentIDExpanded(policyName string, componentIndex int64, policyHash string) string

ComponentIDExpanded returns the ID for a component.

Types

type ClassificationEngine added in v0.5.0

type ClassificationEngine interface {
	RegisterClassifier(classifier Classifier) error
	UnregisterClassifier(classifier Classifier) error
	GetClassifier(classifierID ClassifierID) (Classifier, error)
}

ClassificationEngine is the interface for registering classifiers.

type Classifier added in v0.1.2

type Classifier interface {
	// GetSelector returns the selector.
	GetSelector() *selectorv1.Selector

	// GetClassifierID returns ClassifierID object that should uniquely identify classifier.
	GetClassifierID() ClassifierID

	// GetCounter returns the counter for the classifier
	GetCounter() prometheus.Observer
}

Classifier interface.

type ClassifierID added in v0.1.2

type ClassifierID struct {
	PolicyName      string
	PolicyHash      string
	ClassifierIndex int64
}

ClassifierID is the ID of the Classifier.

func (ClassifierID) String added in v0.1.2

func (cID ClassifierID) String() string

String function returns the ClassifierID as a string.

type Component

type Component interface {
	Policy
	GetComponentIndex() int64
}

Component is the interface that wraps the GetPolicyName, GetPolicyHash, and GetComponentIndex methods.

type ConcurrencyLimiter added in v0.5.0

type ConcurrencyLimiter interface {
	Limiter
	GetObserver(labels map[string]string) prometheus.Observer
}

ConcurrencyLimiter interface.

type Engine

type Engine interface {
	ProcessRequest(controlPoint selectors.ControlPoint, serviceIDs []string, labels map[string]string) *flowcontrolv1.CheckResponse

	RegisterConcurrencyLimiter(sa ConcurrencyLimiter) error
	UnregisterConcurrencyLimiter(sa ConcurrencyLimiter) error
	GetConcurrencyLimiter(limiterID LimiterID) ConcurrencyLimiter

	RegisterFluxMeter(fm FluxMeter) error
	UnregisterFluxMeter(fm FluxMeter) error
	GetFluxMeter(fluxMeterName string) FluxMeter

	RegisterRateLimiter(l RateLimiter) error
	UnregisterRateLimiter(l RateLimiter) error
	GetRateLimiter(limiterID LimiterID) RateLimiter
}

Engine is an interface for registering fluxmeters and schedulers.

type FluxMeter

type FluxMeter interface {
	// GetSelector returns the selector
	GetSelector() *selectorv1.Selector

	// GetAttributeKey returns the attribute key
	GetAttributeKey() string

	// GetFluxMeterName returns the metric name
	GetFluxMeterName() string

	// GetFluxMeterID returns the flux meter ID
	GetFluxMeterID() FluxMeterID

	// GetHistogram returns the histogram observer for the flowcontrolv1.DecisionType
	GetHistogram(decisionType flowcontrolv1.CheckResponse_DecisionType, statusCode string, featureStatus string) prometheus.Observer
}

FluxMeter in an interface for interacting with fluxmeters.

type FluxMeterID

type FluxMeterID struct {
	FluxMeterName string
}

FluxMeterID is the ID of the FluxMeter.

func (FluxMeterID) String

func (fmID FluxMeterID) String() string

String function returns the FluxMeterID as a string.

type Limiter

type Limiter interface {
	GetPolicyName() string
	GetSelector() *selectorv1.Selector
	RunLimiter(labels map[string]string) *flowcontrolv1.LimiterDecision
	GetLimiterID() LimiterID
}

Limiter interface. Lifetime of this interface is per policy/component.

type LimiterID

type LimiterID struct {
	PolicyName     string
	PolicyHash     string
	ComponentIndex int64
}

LimiterID is the ID of the Limiter.

func (LimiterID) String

func (limiterID LimiterID) String() string

String function returns the LimiterID as a string.

type Policy

type Policy interface {
	GetPolicyName() string
	GetPolicyHash() string
}

Policy is the interface that wraps the GetPolicyName, GetPolicyHash methods.

type RateLimiter

type RateLimiter interface {
	Limiter
	TakeN(labels map[string]string, count int) (label string, ok bool, remaining int, current int)
	GetCounter() prometheus.Counter
}

RateLimiter interface.

Jump to

Keyboard shortcuts

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