actuator

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExitWithSuccess            error = errors.New("exit with success")
	ErrFunctionNotLoaded          error = errors.New("function not loaded")
	ErrLoadedFunctionDuplicated   error = errors.New("loaded function duplicated")
	ErrConfigedFunctionDuplicated error = errors.New("configured function duplicated")
	ErrDriverNotFound             error = errors.New("driver not found")
	ErrNameConflict               error = errors.New("name conflict")
	ErrConditionIsFalse           error = errors.New("condition is false")
	ErrNodeReused                 error = errors.New("node reused")
	ErrBuiltinDirectiveNotFound   error = errors.New("builtin directive not found")
)

Functions

func WithResources

func WithResources(resources resource.Resources) func(context.Context, Node) error

Types

type BtfNode

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

btf is an abbreviation for 'back to for' BtfNode back to the starting of 'for' statement, start a new cycle

func (*BtfNode) Exec

func (n *BtfNode) Exec(ctx context.Context) error

func (*BtfNode) FormatString

func (n *BtfNode) FormatString() string

func (*BtfNode) Init

func (n *BtfNode) Init(ctx context.Context, with ...func(context.Context, Node) error) error

func (*BtfNode) Name

func (n *BtfNode) Name() string

type BuiltinNode

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

BuiltinNode be used to execute some builtin functions, e.g. exit, sleep, println...

func (*BuiltinNode) Exec

func (n *BuiltinNode) Exec(ctx context.Context) error

func (*BuiltinNode) FormatString

func (n *BuiltinNode) FormatString() string

func (*BuiltinNode) Init

func (n *BuiltinNode) Init(ctx context.Context, handles ...func(context.Context, Node) error) error

func (*BuiltinNode) Name

func (n *BuiltinNode) Name() string

type ForNode

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

ForNode stands for the starting of 'for' loop statement

func (*ForNode) Exec

func (n *ForNode) Exec(ctx context.Context) error

func (*ForNode) FormatString

func (n *ForNode) FormatString() string

func (*ForNode) Init

func (n *ForNode) Init(ctx context.Context, with ...func(context.Context, Node) error) error

func (*ForNode) Name

func (n *ForNode) Name() string

type Node

type Node interface {
	FormatString() string
	Name() string
	Init(context.Context, ...func(context.Context, Node) error) error
	Exec(context.Context) error
}

Node

type RunQueue

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

RunQueue

func New

func New(rd io.Reader) (*RunQueue, *parser.AST, error)

func (*RunQueue) GetTriggers

func (r *RunQueue) GetTriggers() []Trigger

GetTriggers returns all event triggers

func (*RunQueue) WalkAndExec

func (r *RunQueue) WalkAndExec(ctx context.Context, exec func([]Node) error) error

WalkAndExec is the entry and main program for executing the run queue

func (*RunQueue) WalkNode

func (r *RunQueue) WalkNode(do func(Node) error) error

WalkNode traverses all task nodes in order

type Task

type Task interface {
	Step() int
	Seq() int
	Driver() functiondriver.Driver
	IgnoreFailure() bool
	RetryOnFailure() int
}

type TaskNode

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

TaskNode is the unit of a flow, be used to connect driver and execute the function through the driver

func (*TaskNode) Driver

func (n *TaskNode) Driver() functiondriver.Driver

func (*TaskNode) Exec

func (n *TaskNode) Exec(ctx context.Context) error

func (*TaskNode) FormatString

func (n *TaskNode) FormatString() string

func (*TaskNode) IgnoreFailure

func (n *TaskNode) IgnoreFailure() bool

func (*TaskNode) Init

func (n *TaskNode) Init(ctx context.Context, with ...func(context.Context, Node) error) error

func (*TaskNode) Name

func (n *TaskNode) Name() string

func (*TaskNode) RetryOnFailure

func (n *TaskNode) RetryOnFailure() int

func (*TaskNode) Seq

func (n *TaskNode) Seq() int

func (*TaskNode) Step

func (n *TaskNode) Step() int

type Trigger

type Trigger interface {
	Node
}

Jump to

Keyboard shortcuts

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