flow

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package flow is the parsed graph: pure data, no behavior. The engine decodes each node's Raw config via the registry and schedules the nodes; flow itself imports neither node nor engine, so the dependency graph stays acyclic.

Index

Constants

View Source
const CurrentSchemaVersion = 1

CurrentSchemaVersion is the flow-definition schema this runner speaks. It is stamped on flows so a breaking wire-format change can be versioned: bump this on such a change, migrate older stored flows up to it, and the runner rejects any flow declaring a newer version than it understands. Version 1 is the flat node format (fields at the node top level, *_ms unit-suffixed durations); the pre-versioning "data"-envelope format is unversioned legacy and must be migrated before this runner will accept it.

Variables

This section is empty.

Functions

func Validate

func Validate(f Flow) error

Validate checks structural invariants before execution: every edge references a declared node. Node-shape validation (route targets, referenced child flows) is done by the engine via node capabilities, so flow stays free of node-type knowledge.

Types

type Edge

type Edge struct {
	From string
	To   string
}

Edge is a directed dependency: To runs after From.

type Flow

type Flow struct {
	Name          string
	SchemaVersion int
	Nodes         []Node
	Edges         []Edge
	Inputs        value.Map
}

Flow is a DAG of nodes plus its initial inputs.

func Parse

func Parse(b []byte) (Flow, error)

Parse reads a flow definition from JSON. Each node's full object is retained as Raw so the registry can decode it into the node's typed config.

type Node

type Node struct {
	ID      string
	Kind    spi.Kind
	RunWhen spi.RunWhen
	Raw     json.RawMessage
}

Node is a raw node definition: its id, kind, run-phase, and undecoded config. The engine turns Raw into a node.Bound via the registry. RunWhen is lifted here at parse time so the scheduler needn't re-unmarshal it per node.

Jump to

Keyboard shortcuts

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