executor

package
v0.0.0-...-c4d1a2a Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeSafetyCheck

func TypeSafetyCheck(name string, value string, argumentType string) error

TypeSafetyCheck checks argument values match a specific type. The types are defined in typecheckRegex, and, you guessed it, uses regex to check for allowed characters.

Types

type ExecutionRequest

type ExecutionRequest struct {
	ActionTitle       string
	Action            *config.Action
	Arguments         map[string]string
	TrackingID        string
	Tags              []string
	Cfg               *config.Config
	AuthenticatedUser *acl.AuthenticatedUser
	EntityPrefix      string
	// contains filtered or unexported fields
}

ExecutionRequest is a request to execute an action. It's passed to an Executor. They're created from the grpcapi.

type Executor

type Executor struct {
	Logs map[string]*InternalLogEntry
	// contains filtered or unexported fields
}

Executor represents a helper class for executing commands. It's main method is ExecRequest

func DefaultExecutor

func DefaultExecutor() *Executor

DefaultExecutor returns an Executor, with a sensible "chain of command" for executing actions.

func (*Executor) AddListener

func (e *Executor) AddListener(m listener)

func (*Executor) ExecRequest

func (e *Executor) ExecRequest(req *ExecutionRequest) (*sync.WaitGroup, string)

ExecRequest processes an ExecutionRequest

type InternalLogEntry

type InternalLogEntry struct {
	DatetimeStarted     string
	DatetimeFinished    string
	Stdout              string
	Stderr              string
	StdoutBuffer        io.ReadCloser
	StderrBuffer        io.ReadCloser
	TimedOut            bool
	Blocked             bool
	ExitCode            int32
	Tags                []string
	ExecutionStarted    bool
	ExecutionFinished   bool
	ExecutionTrackingID string

	/*
		The following 3 properties are obviously on Action normally, but it's useful
		that logs are lightweight (so we don't need to have an action associated to
		logs, etc. Therefore, we duplicate those values here.
	*/
	ActionTitle string
	ActionIcon  string
	ActionId    string
}

InternalLogEntry objects are created by an Executor, and represent the final state of execution (even if the command is not executed). It's designed to be easily serializable.

Jump to

Keyboard shortcuts

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