tasks

package
v0.0.0-...-be78b2b Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TaskDefinitionRegistry = map[string]TaskDefinition{}

Task management core

Functions

func FormatTaskFor

func FormatTaskFor(fu *types.TaskFor) (*string, error)

Formats a TaskFor into a string under the 'normal' type. Returns nil if the TaskFor is nil or has an invalid target type

func FormatTaskForSimplex

func FormatTaskForSimplex(fu *types.TaskFor) string

Formats in 'simplex' form (e.g: user/1234567890).

This is mainly used for Object Storage and should NEVER be used for anything else especially database operations

func GetPathFromOutput

func GetPathFromOutput(taskId string, tInfo *types.TaskInfo, outp *types.TaskOutput) string

func ParseTaskFor

func ParseTaskFor(fu string) *types.TaskFor

Parses a TaskFor from a string. Returns nil if the string is invalid.

TaskFor must be in 'normal' (not simplex) form (e.g: u/1234567890).

func RegisterTaskDefinition

func RegisterTaskDefinition(task TaskDefinition)

Types

type TaskDefinition

type TaskDefinition interface {
	// Validate validates the task and sets up state if needed
	Validate(state taskstate.TaskState) error

	// Exec executes the task returning an output if any
	Exec(l *zap.Logger, tcr *types.TaskCreateResponse, state taskstate.TaskState) (*types.TaskOutput, error)

	// Returns the info on a task
	Info() *types.TaskInfo
}

TaskDefinition is the definition for any task that can be executed on splashtail

Directories

Path Synopsis
tasks
To avoid needing to store the entire state even when not needed, tasks defines a state interface to store and fetch only needed state
To avoid needing to store the entire state even when not needed, tasks defines a state interface to store and fetch only needed state

Jump to

Keyboard shortcuts

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