executor

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WorkDir        string   // directory where files needed for the execution are stored
	RuntimeDir     string   // directory where the executable can be found
	ExecutableName string   // name for the executable
	FS             afero.Fs // FS accessor
	Limiter        Limiter  // Resource limiter for executed processes
}

Config represents the Executor configuration.

type Executor

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

Executor provides the capabilities to run external applications.

func New

func New(log zerolog.Logger, options ...Option) (*Executor, error)

New creates a new Executor with the specified working directory.

func (*Executor) ExecuteFunction

func (e *Executor) ExecuteFunction(requestID string, req execute.Request) (execute.Result, error)

ExecuteFunction will run the Blockless function defined by the execution request.

type Limiter

type Limiter interface {
	LimitProcess(proc execute.ProcessID) error
	ListProcesses() ([]int, error)
}

type Option

type Option func(*Config)

func WithExecutableName

func WithExecutableName(name string) Option

WithExecutableName sets the name of the executable that should be ran.

func WithFS

func WithFS(fs afero.Fs) Option

WithFS sets the FS handler used by the executor.

func WithLimiter

func WithLimiter(limiter Limiter) Option

WithLimiter sets the resource limiter called for each individual execution.

func WithRuntimeDir

func WithRuntimeDir(dir string) Option

WithRuntimeDir sets the runtime directory for the executor.

func WithWorkDir

func WithWorkDir(dir string) Option

WithWorkDir sets the workspace directory for the executor.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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