executor

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrExecutorNotConfigured    = errors.New("executor not fully configured")
	ErrDesiredStateNotGenerated = errors.New("desired state was not generated")
	ErrCannotHandle             = errors.New("cannot handle job")
)

Functions

This section is empty.

Types

type Executor

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

Executor is a facade over Grav and Reactr that allows executing local OR remote functions with a single call, ensuring there is no difference between them to the caller.

func New

func New(log *vlog.Logger, transport *websocket.Transport, opts *options.Options) *Executor

New creates a new Executor with the default Grav configuration.

func NewWithGrav added in v0.4.3

func NewWithGrav(log *vlog.Logger, g *grav.Grav, opts *options.Options) *Executor

NewWithGrav creates an Executor with a custom Grav instance.

func (*Executor) DesiredStepState added in v0.4.3

func (e *Executor) DesiredStepState(step executable.Executable, req *request.CoordinatedRequest) (map[string][]byte, error)

DesiredStepState calculates the state as it should be for a particular step's 'with' clause.

func (*Executor) Do

func (e *Executor) Do(jobType string, req *request.CoordinatedRequest, ctx *vk.Ctx, cb grav.MsgFunc) (interface{}, error)

Do executes a local or remote job.

func (*Executor) ListenAndRun added in v0.4.3

func (e *Executor) ListenAndRun(msgType string, run func(grav.Message, interface{}, error)) error

ListenAndRun sets up the executor's Reactr instance to listen for messages and execute the associated job.

func (*Executor) Load

func (e *Executor) Load(source appsource.AppSource) error

Load loads Runnables into the executor's Reactr instance And connects them to the Grav instance.

func (*Executor) Metrics

func (e *Executor) Metrics() (*rt.ScalerMetrics, error)

Metrics returns the executor's Reactr isntance's internal metrics.

func (*Executor) Register

func (e *Executor) Register(jobType string, runner rt.Runnable, capConfig *rcap.CapabilityConfig, opts ...rt.Option) error

Register registers a Runnable.

func (*Executor) Send added in v0.4.3

func (e *Executor) Send(msg grav.Message)

Send sends a message on the configured Pod.

func (*Executor) SetSchedule

func (e *Executor) SetSchedule(sched rt.Schedule) error

SetSchedule adds a Schedule to the executor's Reactr instance.

func (*Executor) UseGrav added in v0.4.3

func (e *Executor) UseGrav(g *grav.Grav)

UseGrav sets a Grav instance to use (in case one was not provided initially) this will NOT set the internal pod, and so internal messages will not be sent.

Jump to

Keyboard shortcuts

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