Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CircuitModule ¶
CircuitModule returns fx options of Circuit for the main app.
Types ¶
type Circuit ¶
type Circuit struct { // Policy Read API iface.PolicyRead // contains filtered or unexported fields }
Circuit manages the runtime state of a set of components and their inter linkages via signals.
func NewCircuitAndOptions ¶
func NewCircuitAndOptions(compWithPortsList []CompiledComponentAndPorts, policyReadAPI iface.PolicyRead) (*Circuit, fx.Option)
NewCircuitAndOptions create a new Circuit struct along with fx options.
func (*Circuit) Execute ¶
Execute runs one tick of computations of all the Components in the Circuit.
func (*Circuit) LockExecution ¶
func (circuit *Circuit) LockExecution()
LockExecution locks the execution of the circuit.
func (*Circuit) RegisterTickEndCallback ¶
func (circuit *Circuit) RegisterTickEndCallback(cb TickEndCallback)
RegisterTickEndCallback adds a callback function to be called when a tick ends.
func (*Circuit) UnlockExecution ¶
func (circuit *Circuit) UnlockExecution()
UnlockExecution unlocks the execution of the circuit.
type CircuitAPI ¶
type CircuitAPI interface { iface.PolicyRead RegisterTickEndCallback(cb TickEndCallback) LockExecution() UnlockExecution() }
CircuitAPI is for read only access to policy and also provides methods for acquiring & releasing circuit execution lock.
type CircuitMetrics ¶
type CircuitMetrics struct {
SignalSummaryVec *prometheus.SummaryVec
}
CircuitMetrics holds prometheus metrics related circuit.
type CompiledComponent ¶
CompiledComponent consists of a Component, its MapStruct and Name.
type CompiledComponentAndPorts ¶
type CompiledComponentAndPorts struct { InPortToSignalsMap PortToSignal OutPortToSignalsMap PortToSignal CompiledComponent CompiledComponent }
CompiledComponentAndPorts consists of a CompiledComponent and its In and Out ports.
type Component ¶
type Component interface {
Execute(inPortReadings PortToValue, tickInfo TickInfo) (outPortReadings PortToValue, err error)
}
Component is the interface that all components must implement.
type PortToSignal ¶
PortToSignal is a map from port name to a slice of Signals.
type PortToValue ¶
PortToValue is a map from port name to a slice of Readings.
func (PortToValue) ReadRepeatedValuePort ¶
func (ptv PortToValue) ReadRepeatedValuePort(portName string) []reading.Reading
ReadRepeatedValuePort returns the reading of all the signals at port=portName. If no signal is found, []reading.Reading{} empty list is returned.
func (PortToValue) ReadSingleValuePort ¶
func (ptv PortToValue) ReadSingleValuePort(portName string) reading.Reading
ReadSingleValuePort returns the reading of the first signal at port=portName. If no signal is found, reading.NewInvalid() is returned.
type Signal ¶
Signal represents a logical flow of Readings in a circuit and determines the linkage between Components.
type TickEndCallback ¶
TickEndCallback is a function that is called when a tick ends.