task

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OutputEnvelopeVersion = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	swf.TaskContext
	// contains filtered or unexported fields
}

func (*Context) AddOutputArtifact

func (c *Context) AddOutputArtifact(a swf.Artifact)

func (*Context) InputArtifacts

func (c *Context) InputArtifacts() []swf.Artifact

type ContextPatch

type ContextPatch struct {
	// Job is a JSON merge patch applied to the job context (contextual.JobContext as JSON).
	Job map[string]any `json:"job,omitempty"`

	// Scopes patches local scoped data structures (e.g. sequence.<id>.outputs).
	Scopes []ScopePatch `json:"scopes,omitempty"`
}

ContextPatch is a persisted, replayable message that mutates template-visible context before the next task execution.

Semantics: - Job: JSON merge patch (RFC 7396-like) applied to contextual.JobContext (by JSON shape). - Scopes: patch step outputs in the currently-visible scoped containers (sequence/states).

Notes:

  • We keep this intentionally JSON-shaped so callers can patch individual fields without requiring per-field pointer types.
  • Null values in the patch delete keys from maps (for map-typed sections).

type OutputEnvelope

type OutputEnvelope struct {
	Version int             `json:"v"`
	Kind    OutputKind      `json:"kind"`
	Payload json.RawMessage `json:"payload,omitempty"`
}

OutputEnvelope is a versioned wrapper for persisted task outputs.

We store outputs in an envelope so SWF cached chapters can safely carry non-task results (e.g. context patches) and workers can branch at replay time.

func NewOutputEnvelope

func NewOutputEnvelope(kind OutputKind, payload any) (OutputEnvelope, error)

func (OutputEnvelope) DecodePayload

func (e OutputEnvelope) DecodePayload(dst any) error

type OutputKind

type OutputKind string
const (
	OutputKindActivityInvocationOutput OutputKind = "activity_output"
	OutputKindContextPatch             OutputKind = "context_patch"
)

type ScopePatch

type ScopePatch struct {
	// Container selects which scope output map to patch.
	// Allowed: "sequence", "states".
	Container string `json:"container"`
	// ID is the step id within the container (e.g. node metadata id).
	ID string `json:"id"`

	// Outputs is a JSON merge patch applied to the step's outputs map.
	Outputs map[string]any `json:"outputs,omitempty"`
}

Jump to

Keyboard shortcuts

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