Documentation
¶
Overview ¶
Package flowengine validates saved flow diagrams and compiles them into component-configuration candidates.
A Flow is authoring state, not a runtime lifecycle record. Engine therefore has no deploy, start, stop, or undeploy operation. ValidateFlowDefinition checks the saved graph against the component factory declarations, while Compile returns a detached component-config map. Neither operation changes configuration or a running process.
The service layer exposes explicit publication of compiled entries. That operation performs sorted, retry-safe upserts through config.Manager and reports exact partial progress. Published values become effective only when a later process boot composes components from configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiscoveredConnection ¶
type DiscoveredConnection struct {
SourceNodeID string `json:"source_node_id"`
SourcePort string `json:"source_port"`
TargetNodeID string `json:"target_node_id"`
TargetPort string `json:"target_port"`
ConnectionID string `json:"connection_id"`
Pattern string `json:"pattern"`
}
DiscoveredConnection represents an auto-discovered connection between ports
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine validates saved flow diagrams and compiles them into component configuration candidates. It never owns component or service lifecycle.
func NewEngine ¶
func NewEngine( componentRegistry *component.Registry, natsClient *natsclient.Client, logger *slog.Logger, metricsRegistry *metric.MetricsRegistry, ) *Engine
NewEngine creates a flow diagram validator/compiler.
func (*Engine) Compile ¶
func (e *Engine) Compile(flow *flowstore.Flow) (config.ComponentConfigs, *ValidationResult, error)
Compile validates a flow diagram and translates each node into one enabled component configuration candidate. The returned map is detached from the flow and has no effect until an explicit publisher persists its entries.
func (*Engine) ValidateFlowDefinition ¶
func (e *Engine) ValidateFlowDefinition(flow *flowstore.Flow) (*ValidationResult, error)
ValidateFlowDefinition validates a saved or draft flow diagram and returns port information plus discovered connections. Validation findings are returned in the result; infrastructure failures are returned as errors.
type ValidatedNode ¶
type ValidatedNode struct {
ID string `json:"id"`
Component string `json:"component"` // Component factory name (e.g., "udp", "graph-processor")
Type types.ComponentType `json:"type"` // Component category (input/processor/output/storage/gateway)
Name string `json:"name"`
InputPorts []ValidatedPort `json:"input_ports"`
OutputPorts []ValidatedPort `json:"output_ports"`
}
ValidatedNode represents a flow node with its port information
type ValidatedPort ¶
type ValidatedPort struct {
Name string `json:"name"`
Direction string `json:"direction"`
Type string `json:"type"` // Interface contract type (e.g., "message.Storable")
Required bool `json:"required"`
ConnectionID string `json:"connection_id"` // NATS subject, network address, etc.
Pattern string `json:"pattern"` // stream, request, watch, api
Description string `json:"description"` // Port description
}
ValidatedPort represents a port with validation information
type ValidationError ¶
type ValidationError struct {
Result *ValidationResult
}
ValidationError wraps validation findings for API responses.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type ValidationIssue ¶
type ValidationIssue struct {
Type string `json:"type"` // "orphaned_port", "disconnected_node", "unknown_component", etc.
Severity string `json:"severity"` // "error", "warning"
ComponentName string `json:"component_name"`
PortName string `json:"port_name,omitempty"`
Message string `json:"message"`
Suggestions []string `json:"suggestions,omitempty"`
}
ValidationIssue represents a single validation problem
type ValidationResult ¶
type ValidationResult struct {
Status string `json:"validation_status"` // "valid", "warnings", "errors"
Errors []ValidationIssue `json:"errors"`
Warnings []ValidationIssue `json:"warnings"`
Nodes []ValidatedNode `json:"nodes"` // Nodes with port information
DiscoveredConnections []DiscoveredConnection `json:"discovered_connections"` // Auto-discovered edges
}
ValidationResult contains the results of flow validation
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator provides flow validation using FlowGraph analysis
func NewValidator ¶
func NewValidator(registry *component.Registry, natsClient *natsclient.Client, logger *slog.Logger) *Validator
NewValidator creates a new flow validator with component registry and NATS client. The validator performs structural, type, and semantic validation of flow definitions before deployment to ensure they can be safely executed.
func (*Validator) ValidateFlow ¶
func (v *Validator) ValidateFlow(flow *flowstore.Flow) (*ValidationResult, error)
ValidateFlow performs comprehensive flow validation using FlowGraph