executor

package
v0.0.0-...-3736fb9 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package executor provides the Work type which is used to execute a pb.WorkReq. This package is the meat of the engine.

To create a Work object, simply:

work := executor.New(req, status}

After creating a Work object, validate it:

if err := work.Validate(); err !=nil {
	// Do something
}

To run the Work object, do:

ch := work.Run()

Once Run() returns, the pb.Status object passed will contain the results of running the WorkReq.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(ctx context.Context, req *pb.WorkReq) error

Validate validates that a WorkReq is valid. This will check that basic values are set correctly and run all policies for this Workflow.

Types

type Work

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

Work is an executor for executing a WorkReq received by the server.

func New

func New(req *pb.WorkReq, status *pb.StatusResp) *Work

New is the constructor for Work.

func (*Work) Run

func (w *Work) Run(ctx context.Context) chan *pb.StatusResp

Run validates that a WorkReq is correct and passed policy, then executes it.

Jump to

Keyboard shortcuts

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