workflow

package
v0.37.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrWorkflowRunTerminal reports an attempted update to a finished run.
	ErrWorkflowRunTerminal = errors.New("workflow run already has a terminal status")
	// ErrWorkflowRunNodeNotFound reports a node absent from the workflow graph.
	ErrWorkflowRunNodeNotFound = errors.New("workflow run node not found")
	// ErrWorkflowRunScopeMismatch reports a run outside the requested route scope.
	ErrWorkflowRunScopeMismatch = errors.New("workflow run does not match route scope")
)
View Source
var ErrScheduleAgentMismatch = errors.New("workflow schedule agent mismatch")

ErrScheduleAgentMismatch reports a schedule outside the requested agent or workflow.

View Source
var ErrWorkflowNotFound = errors.New("workflow not found")

ErrWorkflowNotFound reports a missing workflow in the requested agent scope.

Functions

func Create

func Create(ctx context.Context, pool *pgxpool.Pool, k8sClient ctrlclient.Client, tenantNamespace string, agtName string, req gatewayapi.CreateWorkflowRequest) (workflowdb.Workflow, error)

Create stores a workflow and its graph.

func CreateSchedule

CreateSchedule stores a schedule owned by its agent and returns the stored object.

func CreateScheduledRun

func CreateScheduledRun(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, schName string) (gatewayapi.WorkflowRunSummary, error)

CreateScheduledRun creates one run from one workflow schedule.

func CreateWebhookRun

func CreateWebhookRun(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, inputs []byte, timeoutSeconds int32, apiKeyID string) (gatewayapi.WorkflowRunSummary, error)

CreateWebhookRun creates one direct workflow run from a webhook request.

func DeleteMany

func DeleteMany(ctx context.Context, pool *pgxpool.Pool, k8sClient ctrlclient.Client, tenantNamespace string, agtName string, wfNames []string) error

DeleteMany removes multiple workflows for one agent.

func DeleteRun

func DeleteRun(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, runName string) error

DeleteRun deletes one workflow run.

func DeleteSchedule

func DeleteSchedule(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, name string) error

DeleteSchedule removes a schedule after checking its agent and workflow scope.

func Get

func Get(ctx context.Context, pool *pgxpool.Pool, tenantNamespace string, agtName string, wfName string) (gatewayapi.Workflow, error)

Get reconstructs a stored workflow graph from its related workflow tables.

func ListRuns

func ListRuns(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, params gatewayapi.ListWorkflowRunsParams, limit int, offset int, destinations map[string]int64) ([]gatewayapi.WorkflowRunSummary, int, error)

ListRuns lists non-evaluation runs for a workflow's trigger history.

func ListSchedules

func ListSchedules(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, sortBy gatewayapi.WorkflowScheduleSortByQuery, sortOrder gatewayapi.SortOrderQuery, limit int, offset int, destinations map[string]int64) ([]gatewayapi.WorkflowSchedule, int, error)

ListSchedules returns a sorted page of schedules for an agent and optional workflow.

func ListSummaries

func ListSummaries(ctx context.Context, pool *pgxpool.Pool, tenantNamespace string, agtName string) ([]gatewayapi.WorkflowSummary, error)

ListSummaries returns workflow metadata for one agent without loading nodes or edges.

func ListWebhookTriggers

func ListWebhookTriggers(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, limit int, offset int) ([]gatewayapi.WorkflowWebhookTrigger, int, error)

ListWebhookTriggers lists distinct webhook trigger rows for one agent.

func LockDefinitions added in v0.34.0

func LockDefinitions(ctx context.Context, tx pgx.Tx, ns, agentName string, names []string) ([]workflowdb.WorkflowLockDefinitionsRow, error)

LockDefinitions serializes workflow mutations against owning-agent deletion. An empty names list selects all workflows; named lookups require every target.

func MapGetError

func MapGetError(err error) *apiutil.APIError

MapGetError translates workflow read failures to API errors.

func MapMutationError added in v0.34.0

func MapMutationError(err error) *apiutil.APIError

MapMutationError translates workflow mutation failures to API errors.

func PatchRunNodeStatus

func PatchRunNodeStatus(ctx context.Context, pool *pgxpool.Pool, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, runName string, nodeName string, req gatewayapi.PatchWorkflowRunNodeStatusRequest, msg string) error

PatchRunNodeStatus updates one workflow run node phase.

func PatchRunStatus

func PatchRunStatus(ctx context.Context, k8sClient ctrlclient.Client, ns string, agtName string, wfName string, runName string, req gatewayapi.PatchWorkflowRunStatusRequest, msg string) error

PatchRunStatus updates one running workflow run with a terminal phase.

func RequireUnlocked added in v0.34.0

func RequireUnlocked(rows []workflowdb.WorkflowLockDefinitionsRow) error

RequireUnlocked rejects destructive operations before any cleanup begins.

func RunDetail added in v0.33.0

RunDetail projects an already authorized run without fetching a second snapshot.

func UpdateSchedule

UpdateSchedule replaces a schedule specification, retrying concurrent updates.

func ValidateAgentScheduleList

func ValidateAgentScheduleList(agtName string) []gatewayapi.FieldError

ValidateAgentScheduleList checks the agent name used to list its schedules.

func ValidateCreateRequest

func ValidateCreateRequest(agtName string, req gatewayapi.CreateWorkflowRequest) ([]gatewayapi.FieldError, error)

ValidateCreateRequest checks the input contract and connected, acyclic graph.

func ValidateDeleteRequest

func ValidateDeleteRequest(agtName string, wfNames []string) []gatewayapi.FieldError

ValidateDeleteRequest validates one agent-scoped workflow delete request.

func ValidateListRequest

func ValidateListRequest(agtName string) []gatewayapi.FieldError

ValidateListRequest checks the agent name used to list workflows.

func ValidateLookupRequest

func ValidateLookupRequest(agtName string, wfName string) []gatewayapi.FieldError

ValidateLookupRequest checks agent and workflow names used in route lookup.

func ValidateNodeName

func ValidateNodeName(name string) []gatewayapi.FieldError

ValidateNodeName validates one workflow graph node name.

func ValidateRunInputs

func ValidateRunInputs(ctx context.Context, db workflowdb.DBTX, tenantNamespace string, agtName string, wfName string, raw []byte) ([]gatewayapi.FieldError, error)

ValidateRunInputs validates runtime input values for one workflow.

func ValidateRunListFilters

func ValidateRunListFilters(params gatewayapi.ListWorkflowRunsParams) []gatewayapi.FieldError

ValidateRunListFilters validates workflow run trigger filters.

func ValidateRunListStatus

func ValidateRunListStatus(status *gatewayapi.WorkflowRunStatus) []gatewayapi.FieldError

ValidateRunListStatus validates one workflow run phase filter.

func ValidateRunName

func ValidateRunName(name string) []gatewayapi.FieldError

ValidateRunName validates one workflow run resource name.

func ValidateRunNodePatchPhase

func ValidateRunNodePatchPhase(phase gatewayapi.WorkflowRunNodePatchPhase) []gatewayapi.FieldError

ValidateRunNodePatchPhase validates one node status patch phase.

func ValidateRunStatusMessage

func ValidateRunStatusMessage(message string) []gatewayapi.FieldError

ValidateRunStatusMessage validates one terminal status message.

func ValidateRunTerminalPhase

func ValidateRunTerminalPhase(phase gatewayapi.WorkflowRunTerminalPhase) []gatewayapi.FieldError

ValidateRunTerminalPhase validates a terminal WorkflowRun patch phase.

func ValidateRunWatchNames

func ValidateRunWatchNames(runNames *[]gatewayapi.WorkflowRunName) []gatewayapi.FieldError

ValidateRunWatchNames validates run names used by one watch request.

func ValidateScheduleCreateRequest

func ValidateScheduleCreateRequest(agtName string, wfName string, req *gatewayapi.CreateWorkflowScheduleRequest) []gatewayapi.FieldError

ValidateScheduleCreateRequest trims and validates a new schedule definition.

func ValidateScheduleInputs

func ValidateScheduleInputs(ctx context.Context, tx pgx.Tx, ns, agentName, workflowName string, inputs *gatewayapi.JSONValue) ([]gatewayapi.FieldError, error)

ValidateScheduleInputs checks inputs while the caller holds the workflow mutation lock.

func ValidateScheduleList

func ValidateScheduleList(agtName string, wfName string) []gatewayapi.FieldError

ValidateScheduleList checks the agent and workflow names used to list schedules.

func ValidateScheduleLookup

func ValidateScheduleLookup(agtName string, wfName string, name string) []gatewayapi.FieldError

ValidateScheduleLookup checks the names identifying a schedule.

func ValidateScheduleUpdateRequest

func ValidateScheduleUpdateRequest(agtName string, wfName string, name string, req *gatewayapi.UpdateWorkflowScheduleRequest) []gatewayapi.FieldError

ValidateScheduleUpdateRequest trims and validates a replacement schedule.

Types

type NodePhaseConflictError

type NodePhaseConflictError struct {
	Node    string
	Current agentzv1alpha1.WorkflowRunNodePhase
	Target  agentzv1alpha1.WorkflowRunNodePhase
}

NodePhaseConflictError reports one invalid node phase transition.

func (*NodePhaseConflictError) Error

func (e *NodePhaseConflictError) Error() string

Error identifies the node and its rejected phase transition.

type RunPhaseConflictError

type RunPhaseConflictError struct {
	Current agentzv1alpha1.WorkflowRunPhase
	Target  agentzv1alpha1.WorkflowRunPhase
}

RunPhaseConflictError reports one invalid terminal phase transition.

func (*RunPhaseConflictError) Error

func (e *RunPhaseConflictError) Error() string

Error describes the rejected workflow run transition.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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