Help us shape the future of Go! Take the 2026 Go Developer Survey

protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package protocol defines the interfaces and contracts for pluggable nodes.

Index

Constants

View Source
const ResumePort = "resume"

ResumePort is the input port a held node is activated on when its wait ends or someone resumes it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node interface {
	// ID returns the unique identifier of this node instance.
	ID() string

	// Type returns the node type identifier (e.g., "log", "httprequest", "merge").
	Type() string

	// Execute processes inputs and returns outputs for this node.
	Execute(ctx models.ExecutionContext, inputs map[string]models.NodeResult) (map[string]models.NodeResult, error)

	// InputPorts returns the input ports available on this node.
	InputPorts() []models.InputPort

	// OutputPorts returns the output ports available on this node.
	OutputPorts() []models.OutputPort

	// Validate checks if the provided configuration is valid for this node.
	Validate(config map[string]any) error
}

Node represents an executable unit in a workflow graph.

type NodeFactory

type NodeFactory interface {
	// Create creates a new node instance with the given configuration
	Create(ctx context.Context, id string, config map[string]any) (Node, error)

	// ID returns the unique identifier for this node type
	ID() string

	// Name returns the human-readable name for this node type
	Name() string

	// Description returns a description of what this node does
	Description() string

	// Schema returns the JSON schema for configuring this node
	Schema() map[string]any
}

NodeFactory creates node instances and provides metadata about the node type.

type SuspendError

type SuspendError struct {
	Until time.Time
	Data  map[string]any
}

SuspendError is returned by Execute when the node handed its work to someone who answers later through a resume. The engine stores Data as the node's waiting result and activates the node on ResumePort at Until, or earlier when the answer arrives.

func (*SuspendError) Error

func (s *SuspendError) Error() string

type Waiter

type Waiter interface {
	WaitUntil(ctx models.ExecutionContext, inputs map[string]models.NodeResult) (time.Time, error)
}

Waiter is implemented by nodes that hold their branch until a point in time. The engine calls WaitUntil instead of Execute on the first activation and calls Execute when the branch resumes.

Jump to

Keyboard shortcuts

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