Documentation
¶
Overview ¶
Package graph builds a graph of the workflows in an Arazzo document, showing how steps flow into each other and how workflows and steps depend on each other, and renders it as a Mermaid flowchart or a Graphviz DOT digraph.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EdgeKind ¶
type EdgeKind int
EdgeKind is the kind of an edge in the graph.
const ( // EdgeStart goes from the start of a workflow to its first step. EdgeStart EdgeKind = iota // EdgeNext goes from a step to the next step, which runs when no success action ends the workflow or goes // elsewhere. EdgeNext // EdgeSuccessGoto is a success action going to a step or workflow. EdgeSuccessGoto // EdgeFailureGoto is a failure action going to a step or workflow. EdgeFailureGoto // EdgeRetry is a failure action retrying the step. EdgeRetry // EdgeDependsOn goes from a workflow or step to a workflow or step in its dependsOn. EdgeDependsOn // EdgeCall goes from a step to the workflow it runs. EdgeCall )
type Graph ¶
type Graph struct {
// Direction is the direction the graph is laid out in.
Direction Direction
// Workflows are the workflows in the graph, in document order.
Workflows []*Workflow
// External are the nodes for workflows and steps outside the graph, in the order they are first referenced.
External []*Node
// Edges are the edges in the graph.
Edges []*Edge
}
Graph is a graph of the workflows in an Arazzo document.
func Build ¶
Build builds a graph of the workflows in the document.
Steps run in order unless a success action ends the workflow or goes elsewhere. As actions are taken in order and the first that applies wins, an action without criteria always applies, so no later actions are shown, and the step only leads on to the next step if none of its success actions apply unconditionally. Workflow level actions apply to every step, unless the step has an action with the same name.
type Node ¶
type Node struct {
// ID is a unique identifier for the node that is safe to use in Mermaid and DOT.
ID string
// Kind is the kind of node.
Kind NodeKind
// Label is the workflowId, stepId, or reference of the node.
Label string
// Detail is the operation, operation path, workflow or channel a step targets.
Detail string
}
Node is a node in the graph.
type NodeKind ¶
type NodeKind int
NodeKind is the kind of a node in the graph.
const ( // NodeWorkflow is the start of a workflow in the document. Edges to a workflow point at it. NodeWorkflow NodeKind = iota // NodeStep is a step of a workflow in the document. NodeStep // NodeExternal is a workflow or step outside the graph, such as one in another Arazzo document referenced by a // sourceDescription, a workflow left out by Options.WorkflowID, or a reference that can't be resolved. NodeExternal )
type Options ¶
type Options struct {
// WorkflowID limits the graph to a single workflow. Workflows and steps it references are shown as external nodes.
WorkflowID string
// Direction is the direction the graph is laid out in. Defaults to DirectionTopBottom.
Direction Direction
}
Options configures Build.
type Workflow ¶
type Workflow struct {
// ID is a unique identifier for the workflow's cluster that is safe to use in Mermaid and DOT.
ID string
// WorkflowID is the workflow's workflowId.
WorkflowID string
// Title is the workflow's summary, or its workflowId if it has no summary.
Title string
// Start is the node edges to the workflow point at, which leads to its first step.
Start *Node
// Steps are the nodes for the workflow's steps, in order.
Steps []*Node
}
Workflow is a workflow in the document, with the node for its start and a node for each of its steps.