Documentation ¶
Index ¶
- func DOTGraph(graph *policymonitoringv1.Graph) string
- func DecodePortMap(config any, circuitID string) (runtime.PortToSignals, error)
- func FactoryModule() fx.Option
- func FactoryModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
- func MermaidGraph(graph *policymonitoringv1.Graph) string
- func Module() fx.Option
- type Circuit
- type Tree
- func NewComponentAndOptions(componentProto *policylangv1.Component, componentID runtime.ComponentID, ...) (Tree, []*runtime.ConfiguredComponent, fx.Option, error)
- func ParseNestedCircuit(nestedCircuitID runtime.ComponentID, nestedCircuit *policylangv1.NestedCircuit, ...) (Tree, []*runtime.ConfiguredComponent, fx.Option, error)
- func RootTree(circuitProto *policylangv1.Circuit) (Tree, error)
- func (tree *Tree) CreateComponents(componentsProto []*policylangv1.Component, circuitID runtime.ComponentID, ...) ([]*runtime.ConfiguredComponent, fx.Option, error)
- func (tree *Tree) ExpandCircuit(depth int) []*runtime.ConfiguredComponent
- func (tree *Tree) ExpandSubCircuit(componentID runtime.ComponentID, depth int) ([]*runtime.ConfiguredComponent, []*runtime.ConfiguredComponent, error)
- func (tree *Tree) GetSubGraph(componentID runtime.ComponentID, depth int) (*policymonitoringv1.Graph, error)
- func (tree *Tree) TreeGraph() (*policymonitoringv1.Tree, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DOTGraph ¶ added in v1.1.0
func DOTGraph(graph *policymonitoringv1.Graph) string
DOTGraph returns Components and Links as a DOT graph description.
func DecodePortMap ¶ added in v0.21.0
func DecodePortMap(config any, circuitID string) (runtime.PortToSignals, error)
DecodePortMap decodes a proto port map into a PortToSignals map.
func FactoryModule ¶
FactoryModule for component factory run via the main app.
func FactoryModuleForPolicyApp ¶
func FactoryModuleForPolicyApp(circuitAPI runtime.CircuitAPI) fx.Option
FactoryModuleForPolicyApp for component factory run via the policy app. For singletons in the Policy scope.
func MermaidGraph ¶ added in v1.1.0
func MermaidGraph(graph *policymonitoringv1.Graph) string
MermaidGraph returns Components and Links as a mermaid graph.
Types ¶
type Circuit ¶
type Circuit struct { Tree Tree LeafComponents []*runtime.ConfiguredComponent }
Circuit is a compiled Circuit
Circuit can also be converted to its graph view.
func CompileFromProto ¶
func CompileFromProto( policyProto *policylangv1.Policy, policyReadAPI iface.Policy, ) (*Circuit, fx.Option, error)
CompileFromProto compiles a protobuf circuit definition into a Circuit.
This is helper for CreateComponents + runtime.Compile.
func (*Circuit) CircuitView ¶ added in v1.1.0
func (circuit *Circuit) CircuitView() (*policymonitoringv1.CircuitView, error)
CircuitView returns a CircuitView of the circuit.
func (*Circuit) Components ¶
func (circuit *Circuit) Components() []*runtime.ConfiguredComponent
Components returns a list of CompiledComponents, ready to create runtime.Circuit.
type Tree ¶ added in v0.21.0
type Tree struct { Node *runtime.ConfiguredComponent Children []Tree }
Tree is a graph view of a Circuit.
func NewComponentAndOptions ¶
func NewComponentAndOptions( componentProto *policylangv1.Component, componentID runtime.ComponentID, policyReadAPI iface.Policy, ) (Tree, []*runtime.ConfiguredComponent, fx.Option, error)
NewComponentAndOptions creates parent and leaf components and their fx options for a component spec.
func ParseNestedCircuit ¶ added in v0.21.0
func ParseNestedCircuit( nestedCircuitID runtime.ComponentID, nestedCircuit *policylangv1.NestedCircuit, policyReadAPI iface.Policy, ) (Tree, []*runtime.ConfiguredComponent, fx.Option, error)
ParseNestedCircuit parses a nested circuit and returns the parent, leaf components, and options.
func RootTree ¶ added in v1.1.0
func RootTree(circuitProto *policylangv1.Circuit) (Tree, error)
RootTree returns Tree to represent Circuit root.
func (*Tree) CreateComponents ¶ added in v1.1.0
func (tree *Tree) CreateComponents( componentsProto []*policylangv1.Component, circuitID runtime.ComponentID, policyReadAPI iface.Policy, ) ([]*runtime.ConfiguredComponent, fx.Option, error)
CreateComponents creates circuit components along with their identifiers and fx options.
Note that number of returned components might be greater than number of components in componentsProto, as some components may be composite multi-component stacks or nested circuits.
func (*Tree) ExpandCircuit ¶ added in v1.1.0
func (tree *Tree) ExpandCircuit(depth int) []*runtime.ConfiguredComponent
ExpandCircuit returns a list of ConfiguredComponents in the circuit expanded up to given depth.
func (*Tree) ExpandSubCircuit ¶ added in v1.1.0
func (tree *Tree) ExpandSubCircuit(componentID runtime.ComponentID, depth int) ([]*runtime.ConfiguredComponent, []*runtime.ConfiguredComponent, error)
ExpandSubCircuit returns a list of ConfiguredComponents in the circuit with the component at componentID expanded up to given depth.
func (*Tree) GetSubGraph ¶ added in v1.1.0
func (tree *Tree) GetSubGraph(componentID runtime.ComponentID, depth int) (*policymonitoringv1.Graph, error)
GetSubGraph returns a subgraph of the tree.