workflows

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 18 Imported by: 1 module, 2 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

View Source
const (
	KeywordTrigger = "trigger"
)

Variables

View Source
var (
	InterpolationTokenRe = regexp.MustCompile(`^\$\((\S+)\)$`)
)

Functions

func DeepMap

func DeepMap(input any, transform func(el any) (any, error)) (any, error)

DeepMap recursively applies a transformation function over each string within:

  • a map[string]any
  • a []any
  • a string

func EncodeExecutionID

func EncodeExecutionID(workflowID, eventID string) (string, error)

func GenerateJSONSchema

func GenerateJSONSchema() ([]byte, error)

func ParseWorkflowSpecYaml

func ParseWorkflowSpecYaml(data string) (sdk.WorkflowSpec, error)

func WFYamlSpec

func WFYamlSpec(t *testing.T, name, owner string) string

WFYamlSpec generates a validate yaml spec for a workflow for the given name and owner

Types

type DependencyGraph

type DependencyGraph struct {
	ID string
	graph.Graph[string, *Vertex]

	Triggers []*sdk.StepDefinition

	Spec *sdk.WorkflowSpec
}

DependencyGraph is an intermediate representation of a workflow wherein all the graph vertices are represented and validated. It is a static representation of the workflow dependencies.

func BuildDependencyGraph

func BuildDependencyGraph(spec sdk.WorkflowSpec) (*DependencyGraph, error)

type Mapping

type Mapping map[string]any

func (Mapping) MarshalJSON

func (m Mapping) MarshalJSON() ([]byte, error)

func (*Mapping) UnmarshalJSON

func (m *Mapping) UnmarshalJSON(b []byte) error

type Vertex

type Vertex struct {
	sdk.StepDefinition
	Dependencies []string
}

func (*Vertex) VID

func (v *Vertex) VID() string

VID is an identifier for a Vertex that can be used to uniquely identify it in a graph. it represents the notion `hash` in the graph package AddVertex method. we refrain from naming it `hash` to avoid confusion with the hash function.

type WorkflowSpecYaml

type WorkflowSpecYaml struct {
	Name string `json:"name,omitempty" jsonschema:"pattern=^[0-9A-Za-z_\\-]+$,maxLength=10"` // plain text string exactly 10 characters long, or  empty name allowed for anonymous workflows
	//Name nameYaml `json:"name"`
	Owner string `json:"owner,omitempty" jsonschema:"pattern=^0x[0-9a-fA-F]{40}$"` // 20 bytes represented as hex string with 0x prefix, or empty owner allowed for anonymous workflows
	// Triggers define a starting condition for the workflow, based on specific events or conditions.
	Triggers []triggerDefinitionYaml `json:"triggers" jsonschema:"required"`
	// Actions represent a discrete operation within the workflow, potentially transforming input data.
	Actions []stepDefinitionYaml `json:"actions,omitempty"`
	// Consensus encapsulates the logic for aggregating and validating the results from various nodes.
	Consensus []stepDefinitionYaml `json:"consensus,omitempty"`
	// Targets represents the final step of the workflow, delivering the processed data to a specified location.
	Targets []stepDefinitionYaml `json:"targets" jsonschema:"required"`
	// contains filtered or unexported fields
}

WorkflowSpecYaml is the YAML representation of a workflow spec.

It allows for multiple ways of defining a workflow spec, which we later convert to a single representation, `WorkflowSpec`.

func (WorkflowSpecYaml) ToWorkflowSpec

func (w WorkflowSpecYaml) ToWorkflowSpec() sdk.WorkflowSpec

ToWorkflowSpec converts a WorkflowSpecYaml to a WorkflowSpec.

We support multiple ways of defining a workflow spec yaml, but internally we want to work with a single representation.

Directories

Path Synopsis
sdk
gen command
host
NOTE: loosely based on: https://github.com/tetratelabs/wazero/blob/1353ca24fef0a57a3a342d75f20357a6e9d3be35/internal/wasip1/errno.go#L14
NOTE: loosely based on: https://github.com/tetratelabs/wazero/blob/1353ca24fef0a57a3a342d75f20357a6e9d3be35/internal/wasip1/errno.go#L14
pb

Jump to

Keyboard shortcuts

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