workflow

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 8 Imported by: ? 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

Overview

Package workflow provides an optional, deterministic DAG executor. It is separate from execution so hosts that only need single-run orchestration do not inherit workflow scheduling semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Store    Store
	Handlers map[string]Handler
}

func (Engine) Run

func (e Engine) Run(ctx context.Context, run Run) (Run, error)

type Graph

type Graph struct {
	ID       string `json:"id"`
	Revision uint64 `json:"revision"`
	Nodes    []Node `json:"nodes"`
}

func (Graph) TopologicalOrder

func (g Graph) TopologicalOrder() ([]Node, error)

type Handler

type Handler interface {
	Execute(context.Context, execution.Identity, Node) (artifactDigest string, failureCode string, err error)
}

type HandlerFunc

type HandlerFunc func(context.Context, execution.Identity, Node) (string, string, error)

func (HandlerFunc) Execute

func (f HandlerFunc) Execute(ctx context.Context, owner execution.Identity, node Node) (string, string, error)

type MemoryStore

type MemoryStore struct {
	// contains filtered or unexported fields
}

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func (*MemoryStore) CompareAndSwap

func (s *MemoryStore) CompareAndSwap(ctx context.Context, owner execution.Identity, id string, expected uint64, nodeID string, result NodeResult) (Run, error)

func (*MemoryStore) Create

func (s *MemoryStore) Create(ctx context.Context, run Run) (Run, error)

func (*MemoryStore) Get

func (s *MemoryStore) Get(ctx context.Context, owner execution.Identity, id string) (Run, bool, error)

type Node

type Node struct {
	ID          string   `json:"id"`
	Kind        string   `json:"kind"`
	DependsOn   []string `json:"depends_on,omitempty"`
	InputDigest string   `json:"input_digest"`
}

type NodeResult

type NodeResult struct {
	State          NodeState `json:"state"`
	ArtifactDigest string    `json:"artifact_digest,omitempty"`
	FailureCode    string    `json:"failure_code,omitempty"`
	UpdatedAt      time.Time `json:"updated_at"`
}

type NodeState

type NodeState string
const (
	NodePending       NodeState = "pending"
	NodeRunning       NodeState = "running"
	NodeSucceeded     NodeState = "succeeded"
	NodeFailed        NodeState = "failed"
	NodeSkipped       NodeState = "skipped"
	NodeIndeterminate NodeState = "indeterminate"
)

type Run

type Run struct {
	ID       string                `json:"id"`
	Owner    execution.Identity    `json:"owner"`
	Graph    Graph                 `json:"graph"`
	Nodes    map[string]NodeResult `json:"nodes"`
	Revision uint64                `json:"revision"`
}

type Store

type Store interface {
	Create(context.Context, Run) (Run, error)
	CompareAndSwap(context.Context, execution.Identity, string, uint64, string, NodeResult) (Run, error)
	Get(context.Context, execution.Identity, string) (Run, bool, error)
}

Jump to

Keyboard shortcuts

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