flowcontrol

package
v2.24.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheKeyEmpty is the error returned when the cache key is empty.
	ErrCacheKeyEmpty = errors.New("cache key cannot be empty")
	// ErrCacheControlPointEmpty is the error returned when the cache control point is empty.
	ErrCacheControlPointEmpty = errors.New("cache control_point cannot be empty")
	// ErrCacheNotReady is the error returned when the cache is not ready to be used.
	ErrCacheNotReady = errors.New("cache is not ready")
	// ErrCacheKeyNotFound is the error returned when the key is not found in the cache. This is copied from the internal olric package.
	ErrCacheKeyNotFound = errors.New("key not found")
)
View Source
var CacheFxTag = config.NameTag("cache")

CacheFxTag is the Fx tag for cache's dmap.

Functions

func CacheModule added in v2.24.0

func CacheModule() fx.Option

CacheModule returns the fx options for the cache.

func EngineModule added in v2.24.0

func EngineModule() fx.Option

EngineModule returns the fx options for the engine.

func Module

func Module() fx.Option

Module returns the fx options for dataplane side pieces of policy.

func NewCache added in v2.24.0

func NewCache(dc *distcache.DistCache, lc fx.Lifecycle) (iface.Cache, error)

NewCache creates a new cache.

func NewEngine

func NewEngine(agentInfo *agentinfo.AgentInfo) iface.Engine

NewEngine Main fx app.

func ProvideEngine added in v2.24.0

func ProvideEngine(cache iface.Cache, agentInfo *agentinfo.AgentInfo) iface.Engine

ProvideEngine provides the engine for the dataplane side of policy.

Types

type Cache added in v2.24.0

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

Cache for saving responses at flow end.

func (*Cache) Delete added in v2.24.0

func (c *Cache) Delete(ctx context.Context, controlPoint, key string) error

Delete deletes the value for the given key.

func (*Cache) Get added in v2.24.0

func (c *Cache) Get(ctx context.Context, controlPoint, key string) ([]byte, error)

Get returns the value for the given key.

func (*Cache) Ready added in v2.24.0

func (c *Cache) Ready() error

Ready returns nil if the cache is ready to be used.

func (*Cache) Upsert added in v2.24.0

func (c *Cache) Upsert(ctx context.Context, controlPoint, key string, value []byte, ttl time.Duration) error

Upsert inserts or updates the value for the given key.

type Engine

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

Engine APIs to (1) Get schedulers given a service, control point and set of labels. (2) Get flux meter histogram given a metric id.

func (*Engine) GetAgentInfo

func (e *Engine) GetAgentInfo() *agentinfo.AgentInfo

GetAgentInfo returns the agent info.

func (*Engine) GetFluxMeter

func (e *Engine) GetFluxMeter(fluxMeterName string) iface.FluxMeter

GetFluxMeter Lookup function for getting flux meter.

func (*Engine) GetRateLimiter

func (e *Engine) GetRateLimiter(limiterID iface.LimiterID) iface.RateLimiter

GetRateLimiter Lookup function for getting rate limiter.

func (*Engine) GetSampler added in v2.5.0

func (e *Engine) GetSampler(limiterID iface.LimiterID) iface.Limiter

GetSampler Lookup function for getting sampler.

func (*Engine) GetScheduler added in v2.2.0

func (e *Engine) GetScheduler(limiterID iface.LimiterID) iface.Scheduler

GetScheduler Lookup function for getting scheduler.

func (*Engine) ProcessRequest

func (e *Engine) ProcessRequest(ctx context.Context, requestContext iface.RequestContext) (response *flowcontrolv1.CheckResponse)

ProcessRequest .

func (*Engine) RegisterCache added in v2.24.0

func (e *Engine) RegisterCache(cache iface.Cache)

RegisterCache .

func (*Engine) RegisterFluxMeter

func (e *Engine) RegisterFluxMeter(fm iface.FluxMeter) error

RegisterFluxMeter adds fluxmeter to histogram map and multimatcher.

func (*Engine) RegisterLabelPreview

func (e *Engine) RegisterLabelPreview(lp iface.LabelPreview) error

RegisterLabelPreview adds label preview to multimatcher.

func (*Engine) RegisterRateLimiter

func (e *Engine) RegisterRateLimiter(rl iface.RateLimiter) error

RegisterRateLimiter adds limiter actuator to multimatcher.

func (*Engine) RegisterSampler added in v2.5.0

func (e *Engine) RegisterSampler(l iface.Limiter) error

RegisterSampler adds limiter actuator to multimatcher.

func (*Engine) RegisterScheduler added in v2.2.0

func (e *Engine) RegisterScheduler(cl iface.Scheduler) error

RegisterScheduler adds scheduler to multimatcher.

func (*Engine) UnregisterFluxMeter

func (e *Engine) UnregisterFluxMeter(fm iface.FluxMeter) error

UnregisterFluxMeter removes fluxmeter from histogram map and multimatcher.

func (*Engine) UnregisterLabelPreview

func (e *Engine) UnregisterLabelPreview(lp iface.LabelPreview) error

UnregisterLabelPreview removes label preview from multimatcher.

func (*Engine) UnregisterRateLimiter

func (e *Engine) UnregisterRateLimiter(rl iface.RateLimiter) error

UnregisterRateLimiter removes limiter actuator from multimatcher.

func (*Engine) UnregisterSampler added in v2.5.0

func (e *Engine) UnregisterSampler(rl iface.Limiter) error

UnregisterSampler removes limiter actuator from multimatcher.

func (*Engine) UnregisterScheduler added in v2.2.0

func (e *Engine) UnregisterScheduler(cl iface.Scheduler) error

UnregisterScheduler removes scheduler from multimatcher.

Directories

Path Synopsis
resources
Companion package for github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1 containing conversions of proto-generated struct into golang ones and other helpers.
Companion package for github.com/fluxninja/aperture/api/gen/proto/go/aperture/policy/language/v1 containing conversions of proto-generated struct into golang ones and other helpers.
preview/config
+kubebuilder:validation:Optional
+kubebuilder:validation:Optional

Jump to

Keyboard shortcuts

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