dag

package
v0.0.0-...-33cbb82 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LT          = "<"
	LET         = "<="
	Equal       = "="
	DoubleEqual = "=="
	GT          = ">"
	GET         = ">="
	Regex       = "regexp"
	IN          = "in"
	NotIn       = "notin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BashExecutor

type BashExecutor struct {
}

func (*BashExecutor) Execute

func (be *BashExecutor) Execute(command string) (string, error)

type Dag

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

func BuildDag

func BuildDag(nodes []*DagNode) *Dag

func (*Dag) Run

func (dag *Dag) Run(ctx context.Context) error

type DagCondition

type DagCondition struct {
	Input      string
	Expression string
	Expected   string
}

type DagContext

type DagContext map[string]any

type DagNode

type DagNode struct {
	Name          string            `json:"name,omitempty"`
	Type          string            `json:"type,omitempty"`
	Command       string            `json:"command,omitempty"`
	Content       string            `json:"content,omitempty"`
	OutputAlias   map[string]string `json:"output_alias,omitempty"` // alias any=$(echo 'hello')
	Headers       map[string]string `json:"headers,omitempty"`      // for http type
	Timeout       int               `json:"timeout,omitempty"`
	Depends       []string          `json:"depends,omitempty"` // dep and condition
	Conditions    []DagCondition    `json:"conditions,omitempty"`
	Debug         bool              `json:"debug,omitempty"`
	Retry         int               `json:"retry,omitempty"`
	RetryWaitTime int               `json:"retry_wait_time,omitempty"`

	// for more context
	PreContext DagContext `json:"-"`
	Next       []*DagNode `json:"-"`
	// contains filtered or unexported fields
}

func (*DagNode) ConditionValid

func (dag *DagNode) ConditionValid() bool

func (*DagNode) Execute

func (dag *DagNode) Execute() error

func (*DagNode) WaitDependDone

func (dag *DagNode) WaitDependDone(stop <-chan struct{}, raw map[string]*DagNode)

type DagType

type DagType string

type Executor

type Executor interface {
	Execute(string) (string, error)
}

type HTTPExecutor

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

func NewHTTPExecutor

func NewHTTPExecutor(raw string, timeout int, headers map[string]string) (*HTTPExecutor, error)

func (*HTTPExecutor) Execute

func (he *HTTPExecutor) Execute(body string) (string, error)

Jump to

Keyboard shortcuts

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