circuitfactory

package
v0.22.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DOT

func DOT(components []*policymonitoringv1.ComponentView, links []*policymonitoringv1.Link) string

DOT 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

func FactoryModule() fx.Option

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 Mermaid

func Mermaid(components []*policymonitoringv1.ComponentView, links []*policymonitoringv1.Link) string

Mermaid returns Components and Links as a mermaid graph.

func Module

func Module() fx.Option

Module for circuit and component factory run via the main app.

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(
	componentsProto []*policylangv1.Component,
	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) Components

func (circuit *Circuit) Components() []runtime.ConfiguredComponent

Components returns a list of CompiledComponents, ready to create runtime.Circuit.

func (*Circuit) ToGraphView

func (circuit *Circuit) ToGraphView() ([]*policymonitoringv1.ComponentView, []*policymonitoringv1.Link)

ToGraphView creates a graph (Currently showing depth=1) representation of a Circuit.

type Tree added in v0.21.0

type Tree struct {
	Root     runtime.ConfiguredComponent
	Children []Tree
}

Tree is a graph view of a Circuit.

func CreateComponents

func CreateComponents(
	componentsProto []*policylangv1.Component,
	circuitID runtime.ComponentID,
	policyReadAPI iface.Policy,
) (Tree, []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 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 ParseAIMDConcurrencyController added in v0.21.0

func ParseAIMDConcurrencyController(
	nestedCircuitID runtime.ComponentID,
	aimdConcurrencyController *policylangv1.AIMDConcurrencyController,
	policyReadAPI iface.Policy,
) (Tree, []runtime.ConfiguredComponent, fx.Option, error)

ParseAIMDConcurrencyController parses an AIMD concurrency controller and returns the parent, leaf components, and options.

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.

Jump to

Keyboard shortcuts

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