graph

package
v0.0.0-...-a8fc514 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareDependencies

func CompareDependencies(a, b Identifier) int

func CompareStepDependencies

func CompareStepDependencies(a, b types.StepDependency) int

func MarshalDOT

func MarshalDOT(nodes []Node, serviceValidationSteps map[Identifier]types.ValidationStep) ([]byte, error)

MarshalDOT marshals the graph described by the list of nodes into the DOT notation used by the graphviz library. See documentation here: https://graphviz.gitlab.io/doc/info/lang.html

Types

type Graph

type Graph struct {
	// Services is a lookup table of services by name (the service group).
	Services map[string]*topology.Service

	// ResourceGroups is a lookup table of resource group by name. We flatten the hierarchy of resource groups to
	// not require re-writing the dependency references in every step. Topologies that define more than one unique resource
	// group with the same identifier are disallowed.
	ResourceGroups map[string]*types.ResourceGroupMeta

	// Subscription is an optional set of metadata required for subscription provisioning.
	Subscription *Subscription

	// Steps is a lookup table of service group -> resource group -> step name. Steps are *not* flattened, keeping record
	// of provenance and allowing step names to be kept short, unique only within their resource group.
	Steps map[string]map[string]map[string]types.Step

	// Nodes records every step, and the parent/child relationships between them.
	Nodes []Node

	// ServiceValidationSteps record the service validation steps
	ServiceValidationSteps map[Identifier]types.ValidationStep
	// contains filtered or unexported fields
}

Graph holds a set of nodes, recording parent/child relationships for each, along with a set of lookup tables for the services, resource groups, steps, etc. that the nodes represent.

func ForEntrypoint

func ForEntrypoint(topo *topology.Topology, entrypoint *topology.Entrypoint, pipelines map[string]*types.Pipeline) (*Graph, error)

ForEntrypoint generates a graph for all pipelines in the sub-tree of the topology identified by the entrypoint.

func ForEntrypoints

func ForEntrypoints(topo *topology.Topology, entrypoints []*topology.Entrypoint, pipelines map[string]*types.Pipeline) (*Graph, error)

ForEntrypoints generates a graph for all pipelines in the sub-trees of the topology identified by the entrypoints.

func ForPipeline

func ForPipeline(service *topology.Service, pipeline *types.Pipeline) (*Graph, error)

ForPipeline generates a graph for one pipeline, processing all steps therein to determine dependencies between them.

type Identifier

type Identifier struct {
	ServiceGroup string
	types.StepDependency
}

Dependency records a dependency on a step in a particular service group and resource group. This is the minimum amount of precision required to identify a step in a multi-pipeline execution environment.

func (Identifier) String

func (i Identifier) String() string

type Node

type Node struct {
	// This embedded Dependency defines the identifier for this node.
	Identifier

	// Children contains the direct children (not further descendants) of this node.
	Children []Identifier
	// Parents contains the direct parents (not further ancestors) of this node.
	Parents []Identifier
}

Node records a step along with references to all parents and children. This structure is intentionally devoid of complex data, pointers to the underlying structures needed to execute the steps, etc. Such a structure helps to make operations that produce or operate over these nodes easy to test and verify.

type Subscription

type Subscription struct {
	// ServiceGroup records the service which requested the subscription provisioning. In a multi-service execution graph, there may
	// be many services at play; subscription provisioning requires relative path resolution for role assignment ARM templates, so
	// the path to the service's directory must be known.
	ServiceGroup string

	// ResourceGroup records the semantic identifier for the resource group that requested subscription provisioning. The scope tags
	// used to parameterize the subscription provisioning must be tied to a specific resource group.
	ResourceGroup string

	Config types.SubscriptionProvisioning
}

Subscription holds the metadata required to handle subscription provisioning for an execution graph.

Jump to

Keyboard shortcuts

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