Documentation
¶
Overview ¶
Package dsl parses and validates Packtrail Flow Definitions (YAML) and exposes graph-walk helpers used by the runtime.
Index ¶
Constants ¶
const ( NodeTask = "task" NodeFanout = "fanout" NodeFanin = "fanin" NodeChoice = "choice" NodeSignal = "signal" )
Node types.
const ( JoinAll = "all" JoinAny = "any" JoinQuorum = "quorum" // requires Quorum > 0 )
Join policy kinds for a fanin node.
const DefaultInvoker = "nats-task"
DefaultInvoker is the invoker kind used by a task node that does not set one. It selects packtrail's built-in NATS request/reply transport (pkg/protocol).
Variables ¶
This section is empty.
Functions ¶
func ResolvePlaceholders ¶
ResolvePlaceholders substitutes the {execution_id} placeholder in a task node's target (subject, agent name, URL, …) with the concrete execution id.
Types ¶
type Duration ¶
Duration is a time.Duration that unmarshals from a YAML string like "30s" or "24h". A zero/empty value unmarshals to 0.
type Flow ¶
type Flow struct {
Version string `yaml:"version"`
Name string `yaml:"name"`
Nodes []Node `yaml:"nodes"`
Edges []Edge `yaml:"edges"`
// contains filtered or unexported fields
}
Flow is a parsed, validated Flow Definition.
type Node ¶
type Node struct {
ID string `yaml:"id"`
Type string `yaml:"type"`
// task
Invoker string `yaml:"invoker"` // invocation kind; defaults to DefaultInvoker
Target string `yaml:"target"` // invoker-specific target; defaults to Subject
Subject string `yaml:"subject"` // nats-task subject (alias for Target)
Timeout Duration `yaml:"timeout"`
Retry *RetryPolicy `yaml:"retry"`
// fanout
Branches []string `yaml:"branches"`
// fanin
WaitFor []string `yaml:"wait_for"`
JoinPolicy string `yaml:"join_policy"`
// choice
Rules []Rule `yaml:"rules"`
// signal
SignalName string `yaml:"signal_name"`
OnTimeout string `yaml:"on_timeout"`
}
Node is a single node in the flow graph. Fields are type-specific; Validate enforces which are required for each Type.
func (*Node) InvokeTarget ¶
InvokeTarget returns the invoker-specific target for a task node. Target takes precedence; Subject is kept as the alias so existing nats-task flows are unchanged.
func (*Node) InvokerKind ¶
InvokerKind returns the invoker kind for a task node, defaulting to DefaultInvoker ("nats-task") when unset.
type RetryPolicy ¶
type RetryPolicy struct {
MaxAttempts int `yaml:"max_attempts"`
Backoff string `yaml:"backoff"` // "exponential" | "linear" | "fixed" | "" (default fixed)
}
RetryPolicy controls task retries.