components

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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(timedProto *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 PromQLModule

func PromQLModule() fx.Option

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) 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) 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) 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) 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) Execute

func (exp *Extrapolator) 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) 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) 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) 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) Execute

func (sqrt *Sqrt) 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).

Directories

Path Synopsis
actuators

Jump to

Keyboard shortcuts

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