components

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const NestedSignalPortName = "signal"

NestedSignalPortName is the port name for nested signal ingress and egress components.

Variables

This section is empty.

Functions

func ArithmeticOperatorStrings added in v0.21.0

func ArithmeticOperatorStrings() []string

ArithmeticOperatorStrings returns a slice of all String values of the enum

func ComparisonOperatorStrings added in v0.21.0

func ComparisonOperatorStrings() []string

ComparisonOperatorStrings returns a slice of all String values of the enum

func NewAlerterAndOptions added in v0.11.0

func NewAlerterAndOptions(alerterProto *policylangv1.Alerter, _ string, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)

NewAlerterAndOptions creates alerter and its fx options.

func NewAndAndOptions added in v0.20.0

func NewAndAndOptions(
	_ *policylangv1.And,
	_ string,
	_ iface.Policy,
) (runtime.Component, fx.Option, error)

NewAndAndOptions creates a new And Component.

func NewArithmeticCombinatorAndOptions

func NewArithmeticCombinatorAndOptions(arithmeticCombinatorProto *policylangv1.ArithmeticCombinator, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewArithmeticCombinatorAndOptions returns a new ArithmeticCombinator and its Fx options.

func NewConstantSignal added in v0.21.0

func NewConstantSignal(value float64) runtime.Component

NewConstantSignal creates a variable component with a value that's always valid.

func NewDeciderAndOptions

func NewDeciderAndOptions(deciderProto *policylangv1.Decider, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewDeciderAndOptions creates timed controller and its fx options.

func NewDifferentiator added in v0.19.0

func NewDifferentiator(diffProto *policylangv1.Differentiator) runtime.Component

NewDifferentiator creates a differentiator component.

func NewDifferentiatorAndOptions added in v0.19.0

func NewDifferentiatorAndOptions(diffProto *policylangv1.Differentiator, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewDifferentiatorAndOptions creates a differentiator component and its fx options.

func NewExtrapolatorAndOptions

func NewExtrapolatorAndOptions(extrapolatorProto *policylangv1.Extrapolator, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewExtrapolatorAndOptions creates a new Extrapolator Component.

func NewHolderAndOptions added in v0.21.0

func NewHolderAndOptions(holderProto *policylangv1.Holder, _ string, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)

NewHolderAndOptions creates a holder component and its fx options.

func NewIntegrator added in v0.16.0

func NewIntegrator() runtime.Component

NewIntegrator creates an integrator component.

func NewIntegratorAndOptions added in v0.16.0

func NewIntegratorAndOptions(_ *policylangv1.Integrator, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewIntegratorAndOptions creates an integrator component and its fx options.

func NewInverterAndOptions added in v0.20.0

func NewInverterAndOptions(
	_ *policylangv1.Inverter,
	_ string,
	_ iface.Policy,
) (runtime.Component, fx.Option, error)

NewInverterAndOptions creates a new Inverter Component.

func NewMaxAndOptions

func NewMaxAndOptions(_ *policylangv1.Max, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewMaxAndOptions creates a new Max Component.

func NewMinAndOptions

func NewMinAndOptions(_ *policylangv1.Min, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewMinAndOptions creates a new Min Component.

func NewNestedSignalEgressAndOptions added in v0.21.0

func NewNestedSignalEgressAndOptions(nestedSignalEgressProto *policylangv1.NestedSignalEgress, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewNestedSignalEgressAndOptions creates a new NestedSignalEgress and its options.

func NewNestedSignalIngressAndOptions added in v0.21.0

func NewNestedSignalIngressAndOptions(nestedSignalIngressProto *policylangv1.NestedSignalIngress, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewNestedSignalIngressAndOptions creates a new NestedSignalIngress and its options.

func NewOrAndOptions added in v0.20.0

func NewOrAndOptions(
	_ *policylangv1.Or,
	_ string,
	_ iface.Policy,
) (runtime.Component, fx.Option, error)

NewOrAndOptions creates a new Or Component.

func NewPulseGeneratorAndOptions added in v0.20.0

func NewPulseGeneratorAndOptions(generatorProto *policylangv1.PulseGenerator, _ string, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)

NewPulseGeneratorAndOptions creates an pulse generator component and its fx options.

func NewSqrtAndOptions

func NewSqrtAndOptions(sqrtProto *policylangv1.Sqrt, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewSqrtAndOptions creates a new Sqrt Component.

func NewSwitcherAndOptions added in v0.3.0

func NewSwitcherAndOptions(_ *policylangv1.Switcher, _ string, _ iface.Policy) (runtime.Component, fx.Option, error)

NewSwitcherAndOptions creates a new Switcher Component.

func NewVariableAndOptions added in v0.21.0

func NewVariableAndOptions(variableProto *policylangv1.Variable, _ string, policyReadAPI iface.Policy) (runtime.Component, fx.Option, error)

NewVariableAndOptions creates a variable components and its fx options.

Types

type Alerter added in v0.11.0

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

Alerter is a component that monitors signal value and creates alert on true value.

func (*Alerter) DynamicConfigUpdate added in v0.11.0

func (a *Alerter) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for Alerter.

func (*Alerter) Execute added in v0.11.0

func (a *Alerter) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Alerter) Name added in v0.14.0

func (*Alerter) Name() string

Name implements runtime.Component.

func (*Alerter) Type added in v0.14.0

func (*Alerter) Type() runtime.ComponentType

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*ArithmeticCombinator) Name added in v0.14.0

func (*ArithmeticCombinator) Name() string

Name implements runtime.Component.

func (*ArithmeticCombinator) Type added in v0.14.0

Type implements runtime.Component.

type ArithmeticOperator added in v0.21.0

type ArithmeticOperator int8

ArithmeticOperator is the type of arithmetic operation.

const (
	UnknownArithmetic ArithmeticOperator = iota
	Add
	Sub
	Mul
	Div
	Xor
	LShift
	RShift
)

func ArithmeticOperatorString added in v0.21.0

func ArithmeticOperatorString(s string) (ArithmeticOperator, error)

ArithmeticOperatorString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ArithmeticOperatorValues added in v0.21.0

func ArithmeticOperatorValues() []ArithmeticOperator

ArithmeticOperatorValues returns all values of the enum

func (ArithmeticOperator) IsAArithmeticOperator added in v0.21.0

func (i ArithmeticOperator) IsAArithmeticOperator() bool

IsAArithmeticOperator returns "true" if the value is listed in the enum definition. "false" otherwise

func (ArithmeticOperator) String added in v0.21.0

func (i ArithmeticOperator) String() string

type ComparisonOperator added in v0.21.0

type ComparisonOperator int8

ComparisonOperator is the type of comparison operator.

const (
	UnknownComparison ComparisonOperator = iota
	GT
	LT
	GTE
	LTE
	EQ
	NEQ
)

func ComparisonOperatorString added in v0.21.0

func ComparisonOperatorString(s string) (ComparisonOperator, error)

ComparisonOperatorString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ComparisonOperatorValues added in v0.21.0

func ComparisonOperatorValues() []ComparisonOperator

ComparisonOperatorValues returns all values of the enum

func (ComparisonOperator) IsAComparisonOperator added in v0.21.0

func (i ComparisonOperator) IsAComparisonOperator() bool

IsAComparisonOperator returns "true" if the value is listed in the enum definition. "false" otherwise

func (ComparisonOperator) String added in v0.21.0

func (i ComparisonOperator) String() string

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Decider) Name added in v0.14.0

func (*Decider) Name() string

Name implements runtime.Component.

func (*Decider) Type added in v0.14.0

func (*Decider) Type() runtime.ComponentType

Type implements runtime.Component.

type Differentiator added in v0.19.0

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

Differentiator is a component that calculates rate of change per tick.

func (*Differentiator) DynamicConfigUpdate added in v0.19.0

func (d *Differentiator) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for Differentiator.

func (*Differentiator) Execute added in v0.19.0

func (d *Differentiator) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Differentiator) Name added in v0.19.0

func (*Differentiator) Name() string

Name implements runtime.Component.

func (*Differentiator) Type added in v0.19.0

Type implements runtime.Component.

type EMA

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

EMA is an Exponential Moving Average filter.

func NewEMAAndOptions

func NewEMAAndOptions(emaProto *policylangv1.EMA,
	_ string,
	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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*EMA) Name added in v0.14.0

func (*EMA) Name() string

Name implements runtime.Component.

func (*EMA) Type added in v0.14.0

func (*EMA) Type() runtime.ComponentType

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Extrapolator) Name added in v0.14.0

func (*Extrapolator) Name() string

Name implements runtime.Component.

func (*Extrapolator) Type added in v0.14.0

Type implements runtime.Component.

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, _ string, 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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*FirstValid) Name added in v0.14.0

func (*FirstValid) Name() string

Name implements runtime.Component.

func (*FirstValid) Type added in v0.14.0

Type implements runtime.Component.

type Holder added in v0.21.0

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

Holder is a component that holds the last valid signal value for the specified duration then waits for next valid value to hold.

func (*Holder) DynamicConfigUpdate added in v0.21.0

func (*Holder) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for Holder.

func (*Holder) Execute added in v0.21.0

func (h *Holder) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Holder) Name added in v0.21.0

func (*Holder) Name() string

Name implements runtime.Component.

func (*Holder) Type added in v0.21.0

func (*Holder) Type() runtime.ComponentType

Type implements runtime.Component.

type Integrator added in v0.16.0

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

Integrator is a component that accumulates sum of signal every tick.

func (*Integrator) DynamicConfigUpdate added in v0.16.0

func (in *Integrator) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for Integrator.

func (*Integrator) Execute added in v0.16.0

func (in *Integrator) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Integrator) Name added in v0.16.0

func (*Integrator) Name() string

Name implements runtime.Component.

func (*Integrator) Type added in v0.16.0

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Max) Name added in v0.14.0

func (*Max) Name() string

Name implements runtime.Component.

func (*Max) Type added in v0.14.0

func (*Max) Type() runtime.ComponentType

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Min) Name added in v0.14.0

func (*Min) Name() string

Name implements runtime.Component.

func (*Min) Type added in v0.14.0

func (*Min) Type() runtime.ComponentType

Type implements runtime.Component.

type NestedSignalEgress added in v0.21.0

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

NestedSignalEgress is a component that ingresses a signal into a nested circuit.

func (*NestedSignalEgress) Name added in v0.21.0

func (nse *NestedSignalEgress) Name() string

Name returns the name of the component.

func (*NestedSignalEgress) PortName added in v0.21.0

func (nsi *NestedSignalEgress) PortName() string

PortName returns the port name.

type NestedSignalIngress added in v0.21.0

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

NestedSignalIngress is a component that ingresses a signal into a nested circuit.

func (*NestedSignalIngress) Name added in v0.21.0

func (nsi *NestedSignalIngress) Name() string

Name returns the name of the component.

func (*NestedSignalIngress) PortName added in v0.21.0

func (nsi *NestedSignalIngress) PortName() string

PortName returns the port name.

type NoOp added in v0.21.0

type NoOp struct{}

NoOp takes array of signals and emits noOpimum value.

func (*NoOp) DynamicConfigUpdate added in v0.21.0

func (noOp *NoOp) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for NoOp.

func (*NoOp) Execute added in v0.21.0

func (noOp *NoOp) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*NoOp) Name added in v0.21.0

func (*NoOp) Name() string

Name implements runtime.Component.

func (*NoOp) Type added in v0.21.0

func (*NoOp) Type() runtime.ComponentType

Type implements runtime.Component.

type PulseGenerator added in v0.20.0

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

PulseGenerator is a component that accumulates sum of signal every tick.

func (*PulseGenerator) DynamicConfigUpdate added in v0.20.0

func (*PulseGenerator) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate is a no-op for PulseGenerator.

func (*PulseGenerator) Execute added in v0.20.0

func (pg *PulseGenerator) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*PulseGenerator) Name added in v0.20.0

func (*PulseGenerator) Name() string

Name implements runtime.Component.

func (*PulseGenerator) Type added in v0.20.0

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Sqrt) Name added in v0.14.0

func (*Sqrt) Name() string

Name implements runtime.Component.

func (*Sqrt) Type added in v0.14.0

func (*Sqrt) Type() runtime.ComponentType

Type implements runtime.Component.

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.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Switcher) Name added in v0.14.0

func (*Switcher) Name() string

Name implements runtime.Component.

func (*Switcher) Type added in v0.14.0

func (*Switcher) Type() runtime.ComponentType

Type implements runtime.Component.

type Variable added in v0.21.0

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

Variable is a dynamically configurable variable signal.

func (*Variable) DynamicConfigUpdate added in v0.21.0

func (v *Variable) DynamicConfigUpdate(event notifiers.Event, unmarshaller config.Unmarshaller)

DynamicConfigUpdate finds the dynamic config and syncs the constant value.

func (*Variable) Execute added in v0.21.0

func (v *Variable) Execute(inPortReadings runtime.PortToReading, tickInfo runtime.TickInfo) (runtime.PortToReading, error)

Execute implements runtime.Component.Execute.

func (*Variable) Name added in v0.21.0

func (*Variable) Name() string

Name implements runtime.Component.

func (*Variable) Type added in v0.21.0

func (*Variable) Type() runtime.ComponentType

Type implements runtime.Component.

Directories

Path Synopsis
actuators
tristate is a helper package for tri-state boolean logic, which is used for logical combinator components.
tristate is a helper package for tri-state boolean logic, which is used for logical combinator components.

Jump to

Keyboard shortcuts

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