workflow

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge added in v0.13.0

type Edge struct {
	Src string `hash:"name:1" validate:"required"`
	Dst string `hash:"name:2" validate:"required"`
}

Edge describes the instructions for the workflow to execute a task

type Node added in v0.13.0

type Node struct {
	Key          string    `hash:"name:1" validate:"required"`
	InstanceHash hash.Hash `hash:"name:2" validate:"required"`
	TaskKey      string    `hash:"name:3" validate:"required,printascii"`
}

Node describes the instructions for the workflow to execute a task

type Predicate added in v0.13.0

type Predicate uint

Predicate is the type of conditions that can be applied in a filter of a workflow trigger

const (
	EQ Predicate = iota + 1
)

List of possible conditions for workflow's filter

type Trigger added in v0.13.0

type Trigger struct {
	InstanceHash hash.Hash      `hash:"name:1" validate:"required"`
	TaskKey      string         `hash:"name:2" validate:"printascii,required_without=EventKey"`
	EventKey     string         `hash:"name:3" validate:"printascii,required_without=TaskKey"`
	Filters      TriggerFilters `hash:"name:4" validate:"dive,required"`
	NodeKey      string         `hash:"name:5" validate:"required"`
}

Trigger is an event that triggers a workflow

type TriggerFilter added in v0.13.0

type TriggerFilter struct {
	Key       string      `hash:"name:1" validate:"required,printascii"`
	Predicate Predicate   `hash:"name:2" validate:"required"`
	Value     interface{} `hash:"name:3"`
}

TriggerFilter is the filter definition that can be applied to a workflow trigger

func (*TriggerFilter) Match added in v0.13.0

func (f *TriggerFilter) Match(inputs map[string]interface{}) bool

Match returns true the current filter matches the given data

type TriggerFilters added in v0.13.0

type TriggerFilters []*TriggerFilter

TriggerFilters is a list of filters to apply

func (TriggerFilters) Match added in v0.13.0

func (f TriggerFilters) Match(data map[string]interface{}) bool

Match returns true if the data match the current list of filters

type Workflow

type Workflow struct {
	Hash    hash.Hash `hash:"-" validate:"required"`
	Key     string    `hash:"name:1" validate:"required"`
	Trigger Trigger   `hash:"name:2" validate:"required"`
	Nodes   []Node    `hash:"name:3" validate:"dive,required"`
	Edges   []Edge    `hash:"name:4" validate:"dive,required"`
}

Workflow describes a workflow of a service

func (Workflow) ChildrenIDs added in v0.13.0

func (w Workflow) ChildrenIDs(nodeKey string) []string

ChildrenIDs returns the list of node IDs with a dependency to the current node

func (Workflow) FindNode added in v0.13.0

func (w Workflow) FindNode(key string) (Node, error)

FindNode returns the node matching the key in parameter or an error if not found

func (Workflow) ParentIDs added in v0.13.0

func (w Workflow) ParentIDs(nodeKey string) []string

ParentIDs returns the list of node IDs with the current node as child

func (*Workflow) Validate added in v0.13.0

func (w *Workflow) Validate() error

Validate returns an error if the workflow is invalid for whatever reason

Jump to

Keyboard shortcuts

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