workflows

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 19 Imported by: 2

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 added in v0.2.2

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 added in v0.2.2

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

type Mapping added in v0.2.2

type Mapping map[string]any

func (Mapping) MarshalJSON added in v0.2.2

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

func (*Mapping) UnmarshalJSON added in v0.2.2

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 added in v0.2.2

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 added in v0.2.2

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
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