Documentation ¶
Index ¶
- Variables
- func NewArithmeticCombinatorAndOptions(arithmeticCombinatorProto *policylangv1.ArithmeticCombinator, _ int, ...) (runtime.Component, fx.Option, error)
- func NewConstantAndOptions(constant *policylangv1.Constant, componentIndex int, ...) (runtime.Component, fx.Option, error)
- func NewDeciderAndOptions(deciderProto *policylangv1.Decider, _ int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
- func NewExtrapolatorAndOptions(extrapolatorProto *policylangv1.Extrapolator, componentIndex int, ...) (runtime.Component, fx.Option, error)
- func NewMaxAndOptions(maxProto *policylangv1.Max, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
- func NewMinAndOptions(minProto *policylangv1.Min, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
- func NewSqrtAndOptions(sqrtProto *policylangv1.Sqrt, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
- func NewSwitcherAndOptions(switcherProto *policylangv1.Switcher, componentIndex int, ...) (runtime.Component, fx.Option, error)
- func PromQLModule() fx.Option
- func PromQLModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
- type ArithmeticCombinator
- type Constant
- type Decider
- type EMA
- type Extrapolator
- type FirstValid
- type Max
- type Min
- type PromQL
- type ScalarQuery
- type Sqrt
- type Switcher
- type TaggedQuery
Constants ¶
This section is empty.
Variables ¶
var ErrNoQueriesReturned = errors.New("no queries returned until now")
ErrNoQueriesReturned is returned when no queries are returned by the policy (initial state).
Functions ¶
func NewArithmeticCombinatorAndOptions ¶
func NewArithmeticCombinatorAndOptions(arithmeticCombinatorProto *policylangv1.ArithmeticCombinator, _ int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewArithmeticCombinatorAndOptions returns a new ArithmeticCombinator and its Fx options.
func NewConstantAndOptions ¶
func NewConstantAndOptions(constant *policylangv1.Constant, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewConstantAndOptions creates constant setpoint and its fx options.
func NewDeciderAndOptions ¶
func NewDeciderAndOptions(deciderProto *policylangv1.Decider, _ int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewDeciderAndOptions creates timed controller and its fx options.
func NewExtrapolatorAndOptions ¶
func NewExtrapolatorAndOptions(extrapolatorProto *policylangv1.Extrapolator, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewExtrapolatorAndOptions creates a new Extrapolator Component.
func NewMaxAndOptions ¶
func NewMaxAndOptions(maxProto *policylangv1.Max, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewMaxAndOptions creates a new Max Component.
func NewMinAndOptions ¶
func NewMinAndOptions(minProto *policylangv1.Min, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewMinAndOptions creates a new Min Component.
func NewSqrtAndOptions ¶
func NewSqrtAndOptions(sqrtProto *policylangv1.Sqrt, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewSqrtAndOptions creates a new Sqrt Component.
func NewSwitcherAndOptions ¶ added in v0.3.0
func NewSwitcherAndOptions(switcherProto *policylangv1.Switcher, componentIndex int, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)
NewSwitcherAndOptions creates a new Switcher Component.
func PromQLModule ¶
PromQLModule returns fx options for PromQL in the main app.
func PromQLModuleForPolicyApp ¶
func PromQLModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
PromQLModuleForPolicyApp returns fx options for PromQL in the policy app. Invoked only once per policy.
Types ¶
type ArithmeticCombinator ¶
type ArithmeticCombinator struct {
// contains filtered or unexported fields
}
ArithmeticCombinator takes lhs, rhs input signals and emits computed output via arithmetic operation.
func (*ArithmeticCombinator) DynamicConfigUpdate ¶ added in v0.4.0
func (arith *ArithmeticCombinator) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for ArithmeticCombinator.
func (*ArithmeticCombinator) Execute ¶
func (arith *ArithmeticCombinator) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Constant ¶
type Constant struct {
// contains filtered or unexported fields
}
Constant is a constant signal.
func (*Constant) DynamicConfigUpdate ¶ added in v0.4.0
func (con *Constant) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Constant.
func (*Constant) Execute ¶
func (con *Constant) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Decider ¶
type Decider struct {
// contains filtered or unexported fields
}
Decider controller for testing.
func (*Decider) DynamicConfigUpdate ¶ added in v0.4.0
func (dec *Decider) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Decider.
func (*Decider) Execute ¶
func (dec *Decider) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type EMA ¶
type EMA struct {
// contains filtered or unexported fields
}
EMA is an Exponential Moving Average filter.
func NewEMAAndOptions ¶
func NewEMAAndOptions(emaProto *policylangv1.EMA, _ int, policyReadAPI iface.Policy, ) (*EMA, fx.Option, error)
NewEMAAndOptions returns a new EMA filter and its Fx options.
func (*EMA) DynamicConfigUpdate ¶ added in v0.4.0
func (ema *EMA) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for EMA.
func (*EMA) Execute ¶
func (ema *EMA) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Extrapolator ¶
type Extrapolator struct {
// contains filtered or unexported fields
}
Extrapolator takes an input signal and emits an output signal.
func (*Extrapolator) DynamicConfigUpdate ¶ added in v0.4.0
func (exp *Extrapolator) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Extrapolator.
func (*Extrapolator) Execute ¶
func (exp *Extrapolator) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type FirstValid ¶ added in v0.5.1
type FirstValid struct{}
FirstValid picks the first valid input signal from the array of input signals and emits it as an output signal.
func NewFirstValidAndOptions ¶ added in v0.5.1
func NewFirstValidAndOptions(firstValidProto *policylangv1.FirstValid, componentIndex int, policyReadAPI iface.Policy) (*FirstValid, fx.Option, error)
NewFirstValidAndOptions creates a new FirstValid component and its Fx option.
func (*FirstValid) DynamicConfigUpdate ¶ added in v0.5.1
func (fv *FirstValid) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for FirstValid.
func (*FirstValid) Execute ¶ added in v0.5.1
func (fv *FirstValid) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Max ¶
type Max struct{}
Max takes array of signals and emits maximum value.
func (*Max) DynamicConfigUpdate ¶ added in v0.4.0
func (max *Max) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Max.
func (*Max) Execute ¶
func (max *Max) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Min ¶
type Min struct{}
Min takes array of signals and emits minimum value.
func (*Min) DynamicConfigUpdate ¶ added in v0.4.0
func (min *Min) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Min.
func (*Min) Execute ¶
func (min *Min) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type PromQL ¶
type PromQL struct {
// contains filtered or unexported fields
}
PromQL is a component that runs a Prometheus query in the background and returns the result as a signal Reading.
func NewPromQLAndOptions ¶
func NewPromQLAndOptions( promQLProto *policylangv1.PromQL, componentIndex int, policyReadAPI iface.Policy, ) (*PromQL, fx.Option, error)
NewPromQLAndOptions creates PromQL and its fx options.
func (*PromQL) DynamicConfigUpdate ¶ added in v0.4.0
func (promQL *PromQL) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for PromQL.
func (*PromQL) Execute ¶
func (promQL *PromQL) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (outPortReadings runtime.PortToValue, err error)
Execute implements runtime.Component.Execute.
type ScalarQuery ¶
type ScalarQuery struct {
// contains filtered or unexported fields
}
ScalarQuery is a construct that can be used by other components to get tick aligned scalar results of a PromQL query.
func NewScalarQueryAndOptions ¶
func NewScalarQueryAndOptions( queryString string, evaluationInterval time.Duration, componentIndex int, policyReadAPI iface.Policy, jobPostFix string, ) (*ScalarQuery, fx.Option, error)
NewScalarQueryAndOptions creates a new ScalarQuery and its fx options.
func (*ScalarQuery) ExecuteScalarQuery ¶
func (scalarQuery *ScalarQuery) ExecuteScalarQuery(tickInfo runtime.TickInfo) (float64, error)
ExecuteScalarQuery runs a ScalarQueryJob and returns the current results: value and err. This function is supposed to be run under Circuit Execution Lock (Execution of Circuit Components is protected by this lock).
type Sqrt ¶
type Sqrt struct {
// contains filtered or unexported fields
}
Sqrt takes an input signal and emits Square Root of it multiplied by scale as output.
func (*Sqrt) DynamicConfigUpdate ¶ added in v0.4.0
func (sqrt *Sqrt) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Sqrt.
func (*Sqrt) Execute ¶
func (sqrt *Sqrt) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type Switcher ¶ added in v0.3.0
type Switcher struct{}
Switcher switches between two inputs based on third input.
func (*Switcher) DynamicConfigUpdate ¶ added in v0.4.0
func (dec *Switcher) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)
DynamicConfigUpdate is a no-op for Switcher.
func (*Switcher) Execute ¶ added in v0.3.0
func (dec *Switcher) Execute(inPortReadings runtime.PortToValue, tickInfo runtime.TickInfo) (runtime.PortToValue, error)
Execute implements runtime.Component.Execute.
type TaggedQuery ¶
type TaggedQuery struct {
// contains filtered or unexported fields
}
TaggedQuery is a construct that can be used by other components to get tick aligned prometheus value results of a PromQL query.
func NewTaggedQueryAndOptions ¶
func NewTaggedQueryAndOptions( queryString string, evaluationInterval time.Duration, componentIndex int, policyReadAPI iface.Policy, jobPostFix string, ) (*TaggedQuery, fx.Option, error)
NewTaggedQueryAndOptions creates a new TaggedQuery and its fx options.
func (*TaggedQuery) ExecutePromQuery ¶
func (taggedQuery *TaggedQuery) ExecutePromQuery(tickInfo runtime.TickInfo) (prometheusmodel.Value, error)
ExecutePromQuery runs a PromQueryJob and returns the current results: res and err. This function is supposed to be run under Circuit Execution Lock (Execution of Circuit Components is protected by this lock).