ports

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 3 Imported by: 11

Documentation

Overview

Package ports defines the interfaces (ports) for external dependencies.

Following hexagonal architecture principles, this package contains only interface definitions. Concrete implementations should be in separate repositories (dago, dago-node-*) that depend on this library.

Ports include:

  • LLMClient: Interface for Large Language Model providers
  • ToolExecutor: Interface for executing tools (Python, Bash, HTTP, etc.)
  • EventBus: Interface for event publishing and subscription (Redis Streams)
  • StateStorage: Interface for persisting execution state (Redis)
  • MetricsCollector: Interface for collecting system metrics (Prometheus)

This design allows for:

  • Easy testing with mock implementations
  • Swapping implementations without changing core logic
  • Clear boundaries between domain logic and infrastructure

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompletionChunk

type CompletionChunk struct {
	Delta   string `json:"delta"`
	IsFinal bool   `json:"is_final"`
}

CompletionChunk represents a chunk of a streaming completion (for future use).

type CompletionRequest

type CompletionRequest struct {
	// Messages is the conversation history.
	Messages []Message `json:"messages"`

	// Model is the identifier of the LLM model to use.
	Model string `json:"model"`

	// Temperature controls randomness in the response (0.0 to 1.0).
	Temperature float64 `json:"temperature,omitempty"`

	// MaxTokens is the maximum number of tokens to generate.
	MaxTokens int `json:"max_tokens,omitempty"`

	// TopP controls nucleus sampling (0.0 to 1.0).
	TopP float64 `json:"top_p,omitempty"`

	// Stop is a list of sequences where the LLM should stop generating.
	Stop []string `json:"stop,omitempty"`

	// PresencePenalty penalizes new tokens based on whether they appear in the text so far.
	PresencePenalty float64 `json:"presence_penalty,omitempty"`

	// FrequencyPenalty penalizes new tokens based on their frequency in the text so far.
	FrequencyPenalty float64 `json:"frequency_penalty,omitempty"`

	// User is an optional identifier representing the end-user.
	User string `json:"user,omitempty"`
}

CompletionRequest represents a request for LLM text completion.

type CompletionResponse

type CompletionResponse struct {
	// ID is a unique identifier for this completion.
	ID string `json:"id"`

	// Model is the model that generated this completion.
	Model string `json:"model"`

	// Message is the generated message.
	Message Message `json:"message"`

	// ToolCalls contains any tool calls requested by the LLM.
	ToolCalls []ToolCall `json:"tool_calls,omitempty"`

	// FinishReason indicates why the generation stopped.
	FinishReason string `json:"finish_reason"`

	// Usage contains token usage information.
	Usage UsageInfo `json:"usage"`

	// CreatedAt is the timestamp when this completion was created.
	CreatedAt time.Time `json:"created_at"`
}

CompletionResponse represents the response from an LLM completion.

type Event

type Event struct {
	// ID is a unique identifier for this event.
	ID string `json:"id"`

	// Type is the type of event.
	Type EventType `json:"type"`

	// Timestamp is when the event occurred.
	Timestamp time.Time `json:"timestamp"`

	// ExecutionID is the ID of the graph execution this event relates to.
	ExecutionID string `json:"execution_id"`

	// NodeID is the ID of the node this event relates to (if applicable).
	NodeID string `json:"node_id,omitempty"`

	// Data contains event-specific payload data.
	Data map[string]interface{} `json:"data,omitempty"`

	// Metadata contains additional event metadata.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Event represents a system event.

type EventBus

type EventBus interface {
	// Publish sends an event to a topic.
	Publish(ctx context.Context, topic string, event Event) error

	// Subscribe registers a handler for events on a topic.
	// The handler will be called for each event received.
	Subscribe(ctx context.Context, topic string, handler EventHandler) error

	// Unsubscribe removes a subscription from a topic.
	Unsubscribe(ctx context.Context, topic string) error

	// Close closes the event bus and cleans up resources.
	Close() error
}

EventBus defines the interface for event publishing and subscription. For MVP, this is implemented using Redis Streams.

type EventFilter

type EventFilter struct {
	// Types filters events by type. If empty, all types are included.
	Types []EventType `json:"types,omitempty"`

	// ExecutionID filters events by execution ID.
	ExecutionID string `json:"execution_id,omitempty"`

	// NodeID filters events by node ID.
	NodeID string `json:"node_id,omitempty"`

	// Since filters events after this timestamp.
	Since time.Time `json:"since,omitempty"`

	// Until filters events before this timestamp.
	Until time.Time `json:"until,omitempty"`
}

EventFilter defines criteria for filtering events.

type EventHandler

type EventHandler func(ctx context.Context, event Event) error

EventHandler is a function that processes events.

type EventStore

type EventStore interface {
	// Store persists an event.
	Store(ctx context.Context, event Event) error

	// Query retrieves events matching the filter criteria.
	Query(ctx context.Context, filter EventFilter) ([]Event, error)

	// GetByID retrieves an event by its ID.
	GetByID(ctx context.Context, id string) (*Event, error)

	// GetByExecutionID retrieves all events for a specific execution.
	GetByExecutionID(ctx context.Context, executionID string) ([]Event, error)
}

EventStore defines the interface for persisting and querying events.

type EventType

type EventType string

EventType represents the type of event.

const (
	// EventTypeGraphStarted is emitted when graph execution begins.
	EventTypeGraphStarted EventType = "graph.started"

	// EventTypeGraphCompleted is emitted when graph execution completes successfully.
	EventTypeGraphCompleted EventType = "graph.completed"

	// EventTypeGraphFailed is emitted when graph execution fails.
	EventTypeGraphFailed EventType = "graph.failed"

	// EventTypeNodeStarted is emitted when a node begins execution.
	EventTypeNodeStarted EventType = "node.started"

	// EventTypeNodeCompleted is emitted when a node completes successfully.
	EventTypeNodeCompleted EventType = "node.completed"

	// EventTypeNodeFailed is emitted when a node execution fails.
	EventTypeNodeFailed EventType = "node.failed"

	// EventTypeStateChanged is emitted when execution state is modified.
	EventTypeStateChanged EventType = "state.changed"

	// EventTypeToolExecuted is emitted when a tool is executed.
	EventTypeToolExecuted EventType = "tool.executed"
)

type ExecutionMetadata

type ExecutionMetadata struct {
	// ExecutionID is the unique identifier for this execution.
	ExecutionID string `json:"execution_id"`

	// GraphID is the ID of the graph being executed.
	GraphID string `json:"graph_id"`

	// Status is the current status of the execution.
	Status ExecutionStatus `json:"status"`

	// StartedAt is when the execution started.
	StartedAt time.Time `json:"started_at"`

	// CompletedAt is when the execution completed (if finished).
	CompletedAt *time.Time `json:"completed_at,omitempty"`

	// CurrentNodeID is the ID of the currently executing node.
	CurrentNodeID string `json:"current_node_id,omitempty"`

	// Error contains error information if the execution failed.
	Error string `json:"error,omitempty"`

	// Metadata contains additional execution-specific data.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ExecutionMetadata contains metadata about a graph execution.

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus represents the status of a graph execution.

const (
	// ExecutionStatusPending indicates the execution is queued but not started.
	ExecutionStatusPending ExecutionStatus = "pending"

	// ExecutionStatusRunning indicates the execution is in progress.
	ExecutionStatusRunning ExecutionStatus = "running"

	// ExecutionStatusCompleted indicates the execution finished successfully.
	ExecutionStatusCompleted ExecutionStatus = "completed"

	// ExecutionStatusFailed indicates the execution failed with an error.
	ExecutionStatusFailed ExecutionStatus = "failed"

	// ExecutionStatusCancelled indicates the execution was cancelled.
	ExecutionStatusCancelled ExecutionStatus = "cancelled"
)

type ExecutionStorage

type ExecutionStorage interface {
	// Save persists execution metadata.
	Save(ctx context.Context, metadata ExecutionMetadata) error

	// Load retrieves execution metadata.
	Load(ctx context.Context, executionID string) (*ExecutionMetadata, error)

	// UpdateStatus updates the status of an execution.
	UpdateStatus(ctx context.Context, executionID string, status ExecutionStatus) error

	// List returns all execution metadata, optionally filtered by status.
	List(ctx context.Context, status *ExecutionStatus) ([]ExecutionMetadata, error)

	// Delete removes execution metadata.
	Delete(ctx context.Context, executionID string) error
}

ExecutionStorage defines the interface for persisting execution metadata.

type GraphStorage

type GraphStorage interface {
	// Save persists a graph definition.
	Save(ctx context.Context, graphID string, graphData []byte) error

	// Load retrieves a graph definition.
	Load(ctx context.Context, graphID string) ([]byte, error)

	// Delete removes a graph definition.
	Delete(ctx context.Context, graphID string) error

	// Exists checks if a graph definition exists.
	Exists(ctx context.Context, graphID string) (bool, error)

	// List returns all stored graph IDs.
	List(ctx context.Context) ([]string, error)

	// ListVersions returns all versions of a graph (if versioning is supported).
	ListVersions(ctx context.Context, graphName string) ([]string, error)
}

GraphStorage defines the interface for persisting graph definitions.

type HealthCheck

type HealthCheck struct {
	// Name is the identifier for this health check.
	Name string `json:"name"`

	// Status indicates whether the component is healthy.
	Status HealthStatus `json:"status"`

	// Message provides additional details.
	Message string `json:"message,omitempty"`

	// LastChecked is when this health check was last performed.
	LastChecked time.Time `json:"last_checked"`
}

HealthCheck represents a health check result.

type HealthChecker

type HealthChecker interface {
	// Check performs a health check and returns the result.
	Check(ctx context.Context) HealthCheck

	// Name returns the name of this health check.
	Name() string
}

HealthChecker defines the interface for health checking.

type HealthRegistry

type HealthRegistry interface {
	// Register adds a health checker.
	Register(checker HealthChecker) error

	// Unregister removes a health checker.
	Unregister(name string) error

	// CheckAll runs all registered health checks.
	CheckAll(ctx context.Context) []HealthCheck

	// Check runs a specific health check by name.
	Check(ctx context.Context, name string) (*HealthCheck, error)
}

HealthRegistry manages multiple health checkers.

type HealthStatus

type HealthStatus string

HealthStatus represents the health status of a component.

const (
	// HealthStatusHealthy indicates the component is functioning normally.
	HealthStatusHealthy HealthStatus = "healthy"

	// HealthStatusDegraded indicates the component is functioning but with issues.
	HealthStatusDegraded HealthStatus = "degraded"

	// HealthStatusUnhealthy indicates the component is not functioning.
	HealthStatusUnhealthy HealthStatus = "unhealthy"
)

type JSONSchema

type JSONSchema map[string]interface{}

JSONSchema represents a JSON schema for structured output.

type LLMClient

type LLMClient interface {
	// Complete performs a standard text completion.
	Complete(ctx context.Context, req CompletionRequest) (*CompletionResponse, error)

	// CompleteWithTools performs a completion with tool calling support.
	// The LLM can request tool executions via ToolCall objects in the response.
	CompleteWithTools(ctx context.Context, req CompletionRequest, tools []Tool) (*CompletionResponse, error)

	// CompleteStructured performs a completion with guaranteed JSON schema conformance.
	// The response will be validated against the provided schema.
	CompleteStructured(ctx context.Context, req CompletionRequest, schema JSONSchema) (*StructuredResponse, error)

	// GenerateCompletion performs a generation using domain.LLMRequest (compatibility method).
	GenerateCompletion(ctx context.Context, req interface{}) (interface{}, error)
}

LLMClient defines the interface for interacting with Large Language Models. Implementations should handle provider-specific details (OpenAI, Anthropic, etc).

type Message

type Message struct {
	// Role is the role of the message sender (e.g., "system", "user", "assistant").
	Role string `json:"role"`

	// Content is the text content of the message.
	Content string `json:"content"`

	// Name is an optional name for the message sender.
	Name string `json:"name,omitempty"`
}

Message represents a single message in an LLM conversation.

type MetricsCollector

type MetricsCollector interface {

	// IncGraphsSubmitted increments the count of submitted graphs.
	IncGraphsSubmitted(labels map[string]string)

	// IncGraphsCompleted increments the count of completed graphs.
	IncGraphsCompleted(labels map[string]string)

	// IncGraphsFailed increments the count of failed graphs.
	IncGraphsFailed(labels map[string]string)

	// IncNodesExecuted increments the count of executed nodes.
	IncNodesExecuted(nodeType string, labels map[string]string)

	// IncNodesFailed increments the count of failed nodes.
	IncNodesFailed(nodeType string, labels map[string]string)

	// IncToolExecutions increments the count of tool executions.
	IncToolExecutions(toolName string, labels map[string]string)

	// IncToolFailures increments the count of tool failures.
	IncToolFailures(toolName string, labels map[string]string)

	// IncLLMCalls increments the count of LLM API calls.
	IncLLMCalls(model string, labels map[string]string)

	// IncLLMTokens increments the count of LLM tokens used.
	IncLLMTokens(model string, tokenType string, count int, labels map[string]string)

	// SetWorkerCount sets the current number of workers for a node type.
	SetWorkerCount(nodeType string, count int)

	// SetQueueDepth sets the current depth of the execution queue.
	SetQueueDepth(queueName string, depth int)

	// SetActiveExecutions sets the number of currently active executions.
	SetActiveExecutions(count int)

	// ObserveGraphDuration records the duration of a graph execution.
	ObserveGraphDuration(duration time.Duration, labels map[string]string)

	// ObserveNodeDuration records the duration of a node execution.
	ObserveNodeDuration(nodeType string, duration time.Duration, labels map[string]string)

	// ObserveToolDuration records the duration of a tool execution.
	ObserveToolDuration(toolName string, duration time.Duration, labels map[string]string)

	// ObserveLLMLatency records the latency of an LLM API call.
	ObserveLLMLatency(model string, duration time.Duration, labels map[string]string)

	// ObserveQueueWaitTime records how long an execution waited in the queue.
	ObserveQueueWaitTime(duration time.Duration, labels map[string]string)

	// RecordGraphSubmitted records a graph submission (compatibility method).
	RecordGraphSubmitted(status string)

	// RecordGraphCompleted records a graph completion (compatibility method).
	RecordGraphCompleted(status string, duration time.Duration)

	// RecordNodeExecuted records a node execution (compatibility method).
	RecordNodeExecuted(status string, duration time.Duration)

	// RecordWorkerPoolStatus records worker pool status (compatibility method).
	RecordWorkerPoolStatus(idle, busy, stopped int)
}

MetricsCollector defines the interface for collecting system metrics. For MVP, this is implemented using Prometheus.

type MetricsConfig

type MetricsConfig struct {
	// Enabled controls whether metrics collection is active.
	Enabled bool `json:"enabled"`

	// Port is the HTTP port for the metrics endpoint.
	Port int `json:"port"`

	// Path is the HTTP path for the metrics endpoint (e.g., "/metrics").
	Path string `json:"path"`

	// Namespace is a prefix for all metric names.
	Namespace string `json:"namespace"`

	// Subsystem is a secondary prefix for metric names.
	Subsystem string `json:"subsystem"`
}

MetricsConfig contains configuration for metrics collection.

type StateStorage

type StateStorage interface {
	// Save persists the state for an execution.
	Save(ctx context.Context, executionID string, state state.State) error

	// Load retrieves the state for an execution.
	Load(ctx context.Context, executionID string) (state.State, error)

	// Delete removes the state for an execution.
	Delete(ctx context.Context, executionID string) error

	// Exists checks if state exists for an execution.
	Exists(ctx context.Context, executionID string) (bool, error)

	// SetTTL sets a time-to-live for state data.
	// After the TTL expires, the state will be automatically deleted.
	SetTTL(ctx context.Context, executionID string, ttl time.Duration) error

	// List returns all execution IDs that have stored state.
	List(ctx context.Context) ([]string, error)

	// SaveState persists graph state (compatibility method).
	SaveState(ctx context.Context, state interface{}) error

	// GetState retrieves graph state (compatibility method).
	GetState(ctx context.Context, graphID string) (interface{}, error)
}

StateStorage defines the interface for persisting execution state. For MVP, this is implemented using Redis.

type StructuredResponse

type StructuredResponse struct {
	// Data contains the structured data conforming to the provided schema.
	Data map[string]interface{} `json:"data"`

	// Usage contains token usage information.
	Usage UsageInfo `json:"usage"`

	// CreatedAt is the timestamp when this response was created.
	CreatedAt time.Time `json:"created_at"`
}

StructuredResponse represents a response with structured JSON output.

type Tool

type Tool struct {
	// Name is the unique identifier for the tool.
	Name string `json:"name"`

	// Description explains what the tool does.
	Description string `json:"description"`

	// Parameters is a JSON schema defining the tool's input parameters.
	Parameters map[string]interface{} `json:"parameters"`
}

Tool represents a tool that can be called by the LLM.

type ToolCall

type ToolCall struct {
	// ID is a unique identifier for this tool call.
	ID string `json:"id"`

	// Name is the name of the tool to call.
	Name string `json:"name"`

	// Arguments contains the tool call arguments as a JSON object.
	Arguments map[string]interface{} `json:"arguments"`
}

ToolCall represents a request from the LLM to call a tool.

type ToolConfig

type ToolConfig struct {
	// Timeout is the maximum execution time for tools.
	Timeout time.Duration `json:"timeout"`

	// MaxRetries is the number of retry attempts on failure.
	MaxRetries int `json:"max_retries"`

	// RetryDelay is the delay between retry attempts.
	RetryDelay time.Duration `json:"retry_delay"`

	// Sandbox enables sandboxed execution for security.
	Sandbox bool `json:"sandbox"`

	// Environment contains environment variables for tool execution.
	Environment map[string]string `json:"environment,omitempty"`
}

ToolConfig represents configuration for tool execution.

type ToolExecutor

type ToolExecutor interface {
	// Execute runs the tool with the given parameters.
	Execute(ctx context.Context, params map[string]interface{}) (*ToolResult, error)

	// Schema returns the tool's schema definition.
	Schema() *ToolSchema

	// Type returns the type of this tool.
	Type() ToolType

	// Validate checks if the given parameters are valid for this tool.
	Validate(params map[string]interface{}) error
}

ToolExecutor defines the interface for executing tools. Each tool type (Python, Bash, HTTP, etc.) implements this interface.

type ToolRegistry

type ToolRegistry interface {
	// Register adds a tool executor to the registry.
	Register(name string, executor ToolExecutor) error

	// Get retrieves a tool executor by name.
	Get(name string) (ToolExecutor, error)

	// List returns all registered tool names.
	List() []string

	// Unregister removes a tool executor from the registry.
	Unregister(name string) error

	// GetByType returns all tools of a specific type.
	GetByType(toolType ToolType) []ToolExecutor
}

ToolRegistry manages available tools and their executors.

type ToolResult

type ToolResult struct {
	// Success indicates whether the tool executed successfully.
	Success bool `json:"success"`

	// Output contains the tool's output data.
	Output map[string]interface{} `json:"output,omitempty"`

	// Error contains error information if the tool failed.
	Error string `json:"error,omitempty"`

	// ExecutionTime is the duration of the tool execution.
	ExecutionTime time.Duration `json:"execution_time"`

	// Metadata contains additional execution metadata.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ToolResult represents the result of a tool execution.

type ToolSchema

type ToolSchema struct {
	// Name is the unique identifier for the tool.
	Name string `json:"name"`

	// Description explains what the tool does.
	Description string `json:"description"`

	// InputSchema is a JSON schema defining the tool's input parameters.
	InputSchema map[string]interface{} `json:"input_schema"`

	// OutputSchema is a JSON schema defining the tool's output format.
	OutputSchema map[string]interface{} `json:"output_schema,omitempty"`
}

ToolSchema defines the schema for a tool's inputs.

type ToolType

type ToolType string

ToolType represents the type of tool executor.

const (
	// ToolTypePython executes Python code.
	ToolTypePython ToolType = "python"

	// ToolTypeBash executes bash commands.
	ToolTypeBash ToolType = "bash"

	// ToolTypeHTTP makes HTTP requests.
	ToolTypeHTTP ToolType = "http"

	// ToolTypeCustom is a user-defined tool type.
	ToolTypeCustom ToolType = "custom"
)

type UsageInfo

type UsageInfo struct {
	// PromptTokens is the number of tokens in the prompt.
	PromptTokens int `json:"prompt_tokens"`

	// CompletionTokens is the number of tokens in the completion.
	CompletionTokens int `json:"completion_tokens"`

	// TotalTokens is the total number of tokens used.
	TotalTokens int `json:"total_tokens"`
}

UsageInfo contains token usage statistics.

type WorkerFilter added in v0.2.1

type WorkerFilter struct {
	// Types filters workers by type. If empty, all types are included.
	Types []WorkerType `json:"types,omitempty"`

	// Statuses filters workers by status. If empty, all statuses are included.
	Statuses []WorkerStatus `json:"statuses,omitempty"`

	// HealthyOnly if true, only returns workers with recent heartbeats.
	HealthyOnly bool `json:"healthy_only,omitempty"`
}

WorkerFilter defines criteria for filtering workers.

type WorkerInfo added in v0.2.1

type WorkerInfo struct {
	// ID is the unique identifier for this worker.
	ID string `json:"id"`

	// Type is the type of worker (executor or router).
	Type WorkerType `json:"type"`

	// Status is the current status of the worker.
	Status WorkerStatus `json:"status"`

	// RegisteredAt is when the worker was first registered.
	RegisteredAt time.Time `json:"registered_at"`

	// LastHeartbeat is the timestamp of the last heartbeat received.
	LastHeartbeat time.Time `json:"last_heartbeat"`

	// CurrentTask is the ID of the task currently being processed (if any).
	CurrentTask string `json:"current_task,omitempty"`

	// PendingTasks is the number of tasks pending in this worker's queue.
	PendingTasks int `json:"pending_tasks"`

	// Version is the worker's software version.
	Version string `json:"version,omitempty"`

	// Metadata contains additional worker-specific information.
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

WorkerInfo contains information about a registered worker.

type WorkerRegistry added in v0.2.1

type WorkerRegistry interface {
	// Register registers a new worker in the system.
	// This should be called when a worker starts up.
	Register(ctx context.Context, worker WorkerInfo) error

	// Unregister removes a worker from the registry.
	// This should be called when a worker shuts down gracefully.
	Unregister(ctx context.Context, workerID string) error

	// Heartbeat updates the last heartbeat timestamp for a worker.
	// This should be called periodically (e.g., every 5-10 seconds) to indicate
	// that the worker is still alive.
	Heartbeat(ctx context.Context, workerID string, status WorkerStatus, currentTask string) error

	// GetWorker retrieves information about a specific worker.
	GetWorker(ctx context.Context, workerID string) (*WorkerInfo, error)

	// ListWorkers retrieves all workers matching the filter criteria.
	ListWorkers(ctx context.Context, filter WorkerFilter) ([]WorkerInfo, error)

	// GetWorkerStats returns aggregate statistics about workers.
	GetWorkerStats(ctx context.Context, workerType WorkerType) (*WorkerStats, error)

	// CleanupStaleWorkers removes workers that haven't sent a heartbeat
	// within the specified timeout duration.
	// This is typically called periodically by the orchestrator.
	CleanupStaleWorkers(ctx context.Context, timeout time.Duration) (int, error)
}

WorkerRegistry defines the interface for managing worker registration and heartbeats. This interface is transport-agnostic and can be implemented using Redis, Kafka, WebSockets, database, or any other mechanism.

type WorkerStats added in v0.2.1

type WorkerStats struct {
	// Type is the worker type these stats refer to.
	Type WorkerType `json:"type"`

	// TotalWorkers is the total number of registered workers.
	TotalWorkers int `json:"total_workers"`

	// IdleWorkers is the number of workers in idle status.
	IdleWorkers int `json:"idle_workers"`

	// BusyWorkers is the number of workers in busy status.
	BusyWorkers int `json:"busy_workers"`

	// UnhealthyWorkers is the number of workers in unhealthy status.
	UnhealthyWorkers int `json:"unhealthy_workers"`

	// TotalPendingTasks is the total number of pending tasks across all workers.
	TotalPendingTasks int `json:"total_pending_tasks"`
}

WorkerStats contains aggregate statistics about workers of a specific type.

type WorkerStatus added in v0.2.1

type WorkerStatus string

WorkerStatus represents the current status of a worker.

const (
	// WorkerStatusIdle means the worker is running but not processing any task.
	WorkerStatusIdle WorkerStatus = "idle"

	// WorkerStatusBusy means the worker is currently processing a task.
	WorkerStatusBusy WorkerStatus = "busy"

	// WorkerStatusUnhealthy means the worker missed heartbeat(s).
	WorkerStatusUnhealthy WorkerStatus = "unhealthy"

	// WorkerStatusStopped means the worker has been explicitly stopped.
	WorkerStatusStopped WorkerStatus = "stopped"
)

type WorkerType added in v0.2.1

type WorkerType string

WorkerType represents the type of worker.

const (
	// WorkerTypeExecutor is a worker that executes executor nodes.
	WorkerTypeExecutor WorkerType = "executor"

	// WorkerTypeRouter is a worker that executes router nodes.
	WorkerTypeRouter WorkerType = "router"
)

Jump to

Keyboard shortcuts

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