workflows

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentdExecutor

type AgentdExecutor interface {
	Execute(ctx context.Context, podIP string, req *NodeExecRequest) (*NodeExecResponse, error)
}

type AppEngineLogger

type AppEngineLogger struct {
	LogFn func(msg string, kv ...any)
	ErrFn func(err error, msg string, kv ...any)
}

AppEngineLogger adapts an external logger to the engine's Logger interface. The concrete type is created by the caller (app.go) — this struct is just a type definition that the caller wraps around its own logger.

func (*AppEngineLogger) Error

func (l *AppEngineLogger) Error(err error, msg string, kv ...any)

func (*AppEngineLogger) Info

func (l *AppEngineLogger) Info(msg string, kv ...any)

type HTTPAgentExecutor

type HTTPAgentExecutor struct {
	Port   int
	Client *http.Client
}

HTTPAgentExecutor calls agentd on the workspace pod via HTTP. Uses context for cancellation and timeout propagation.

func (*HTTPAgentExecutor) Execute

type K8sWorkspaceActivator

type K8sWorkspaceActivator struct {
	K8sClient pkgk8s.KubernetesClient
	Namespace string
}

func (*K8sWorkspaceActivator) EnsureActive

func (a *K8sWorkspaceActivator) EnsureActive(ctx context.Context, workspaceID string, timeout time.Duration) (string, error)

type Logger

type Logger interface {
	Info(msg string, keysAndValues ...any)
	Error(err error, msg string, keysAndValues ...any)
}

type NodeExecRequest

type NodeExecRequest struct {
	NodeID   string          `json:"nodeId"`
	NodeType string          `json:"nodeType"`
	Spec     json.RawMessage `json:"spec"`
	Input    json.RawMessage `json:"input"`
	Timeout  string          `json:"timeout,omitempty"`
}

type NodeExecResponse

type NodeExecResponse struct {
	Output    json.RawMessage `json:"output,omitempty"`
	Branch    string          `json:"branch,omitempty"`
	ErrorCode string          `json:"errorCode,omitempty"`
	Detail    string          `json:"detail,omitempty"`
}

type Reconciler

type Reconciler struct {
	Store         ReconcilerStore
	AgentdClient  AgentdExecutor
	Activator     WorkspaceActivator
	Logger        Logger
	MaxConcurrent int
	TickInterval  time.Duration
	// contains filtered or unexported fields
}

func (*Reconciler) Cancel

func (r *Reconciler) Cancel(runID string)

func (*Reconciler) Start

func (r *Reconciler) Start(ctx context.Context) error

type ReconcilerStore

type ReconcilerStore interface {
	ClaimQueuedRuns(ctx context.Context, limit int) ([]*wf.WorkflowRunRow, error)
	UpdateWorkflowRunStatus(ctx context.Context, runID, status string, errorCode *string, errMsg json.RawMessage, output json.RawMessage) error
	CreateNodeRun(ctx context.Context, row *wf.WorkflowNodeRunRow) error
	UpdateNodeRunStatus(ctx context.Context, nodeRunID, status string, output json.RawMessage, branch *string, errorCode *string, errMsg json.RawMessage) error
	IncrementTriggerFailures(ctx context.Context, triggerID string) (int, error)
	ResetTriggerFailures(ctx context.Context, triggerID string) error
}

type Scheduler

type Scheduler struct {
	Store        SchedulerStore
	Logger       Logger
	TickInterval time.Duration
}

func (*Scheduler) Start

func (s *Scheduler) Start(ctx context.Context) error

type SchedulerStore

type SchedulerStore interface {
	ListDueCronTriggers(ctx context.Context, now time.Time, limit int) ([]*wf.TriggerRow, error)
	GetWorkflow(ctx context.Context, ownerType, ownerID, workflowID string) (*wf.WorkflowRow, error)
	CreateWorkflowRunWithFire(ctx context.Context, fire *wf.TriggerFireRow, run *wf.WorkflowRunRow) error
	CreateTriggerFire(ctx context.Context, row *wf.TriggerFireRow) error
	UpdateTriggerFireTimestamps(ctx context.Context, triggerID string, lastFiredAt time.Time, nextFireAt *time.Time) error
	IncrementTriggerFailures(ctx context.Context, triggerID string) (int, error)
	DisableTrigger(ctx context.Context, triggerID string) error
}

type WorkspaceActivator

type WorkspaceActivator interface {
	EnsureActive(ctx context.Context, workspaceID string, timeout time.Duration) (podIP string, err error)
}

Jump to

Keyboard shortcuts

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