task

package
v1.1.1291 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionType added in v1.1.1139

type ExecutionType int

ExecutionType defines the style of execution required for a function e.g. Strongly Typed, or vars Map[string]interface

const (
	// ExecutionTypeVars signals a function is loosely typed.
	ExecutionTypeVars ExecutionType = iota
	// ExecutionTypeTyped signals a function is strongly typed.
	ExecutionTypeTyped
)

type FnDef added in v1.1.1139

type FnDef struct {
	Type       ExecutionType
	Fn         any
	OutMapping map[string]string
	InMapping  map[string]string
}

FnDef is a general definition of a function including any mapping needed to call it.

type JobClient

type JobClient interface {
	LogClient
	OriginalVars() (input map[string]interface{}, output map[string]interface{})
}

JobClient represents a client that is sent to all service tasks to facilitate logging.

type LogClient

type LogClient interface {
	// Log logs to the underlying SHAR infrastructure.
	// Deprecated: Use Logger or LoggerWith to obtain a SHAR slog.Logger instance
	Log(ctx context.Context, level slog.Level, message string, attrs map[string]string) error
	// Logger returns a SHAR slog.Logger based on the default logger.  This is syntactic sugar around c.LoggerWith(slog.Default())
	Logger() *slog.Logger
	// LoggerWith returns a SHAR slog.Logger based on the provided logger.
	LoggerWith(logger *slog.Logger) *slog.Logger
}

LogClient represents a client which is capable of logging to the SHAR infrastructure.

type MessageClient

type MessageClient interface {
	LogClient
	// SendMessage sends a Workflow Message
	SendMessage(ctx context.Context, name string, key any, vars model.Vars) error
}

MessageClient represents a client which supports logging and sending Workflow Messages to the underlying SHAR infrastructure.

type ProcessTerminateFn

type ProcessTerminateFn func(ctx context.Context, vars model.Vars, wfError *model.Error, endState model.CancellationState)

ProcessTerminateFn provides the signature for process terminate functions.

type SenderFn

type SenderFn func(ctx context.Context, client MessageClient, vars model.Vars) error

SenderFn provides the signature for functions that can act as Workflow Message senders.

type ServiceFn

type ServiceFn func(ctx context.Context, client JobClient, vars model.Vars) (model.Vars, error)

ServiceFn provides the signature for service task functions.

Jump to

Keyboard shortcuts

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