runtimecodec

package
v0.0.41 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvelopeVersion = 1

	PayloadKindApp         = "App"
	PayloadKindAppError    = "AppError"
	PayloadKindSystemError = "SystemError"
	PayloadKindTimeout     = "Timeout"

	ChapterTypeJobStart           = "JobStart"
	ChapterTypeJobAttemptOutcome  = "JobAttemptOutcome"
	ChapterTypeTaskAttemptOutcome = "TaskAttemptOutcome"
	ChapterTypeRestartExtra       = "RestartExtra"
)

Variables

This section is empty.

Functions

func ChapterBodyFromWire

func ChapterBodyFromWire(chapterType string, payloadKind string, data json.RawMessage) (jobdb.ChapterBody, error)

func ChapterBodyToWire

func ChapterBodyToWire(body jobdb.ChapterBody) (string, string, json.RawMessage, error)

func ChapterIs

func ChapterIs(chapter jobdb.Chapter, want string) bool

ChapterIs reports whether a typed chapter maps to the requested storage chapter discriminator.

func ChapterMetadataFromJSON

func ChapterMetadataFromJSON(raw json.RawMessage) (jobdb.ChapterMetadata, error)

func ChapterMetadataToJSON

func ChapterMetadataToJSON(metadata jobdb.ChapterMetadata) (json.RawMessage, error)

func ChapterOutcomeFromWire

func ChapterOutcomeFromWire(payloadKind string, data json.RawMessage) (jobdb.ChapterOutcome, error)

func ChapterOutcomeToWire

func ChapterOutcomeToWire(outcome jobdb.ChapterOutcome) (string, json.RawMessage, error)

func ChapterPayload

func ChapterPayload(chapter jobdb.Chapter) (string, json.RawMessage, error)

ChapterPayload returns the storage payload discriminator and payload bytes for a typed chapter.

func ChapterType

func ChapterType(chapter jobdb.Chapter) (string, error)

ChapterType returns the storage discriminator for a typed chapter.

func CloneChapter

func CloneChapter(chapter jobdb.Chapter) jobdb.Chapter

func CloneChapterBody

func CloneChapterBody(body jobdb.ChapterBody) jobdb.ChapterBody

func CloneChapterMetadata

func CloneChapterMetadata(metadata jobdb.ChapterMetadata) jobdb.ChapterMetadata

func CloneChapterOutcome

func CloneChapterOutcome(outcome jobdb.ChapterOutcome) jobdb.ChapterOutcome

func DecodeWaitForJobs

func DecodeWaitForJobs(raw []byte) ([]string, error)

func EncodeChapter

func EncodeChapter(meta ChapterMeta, chapterType string, payloadKind string, payload json.RawMessage) ([]byte, error)

func EncodeSchedulerPayload

func EncodeSchedulerPayload(payload SchedulerPayload) ([]byte, error)

func EncodeSchedulerPayloadJSON

func EncodeSchedulerPayloadJSON(payload SchedulerPayload) (json.RawMessage, error)

func EncodeWaitForJobs

func EncodeWaitForJobs(jobIDs []string) ([]byte, error)

Types

type ChapterEnvelope

type ChapterEnvelope struct {
	ChapterType string
	Meta        ChapterMeta
	PayloadKind string
	Payload     json.RawMessage
}

func DecodeChapter

func DecodeChapter(body []byte) (ChapterEnvelope, error)

type ChapterMeta

type ChapterMeta struct {
	InitialPayloadDigest string                  `json:"initial_payload_digest,omitempty"`
	Version              int                     `json:"version"`
	Ordinal              int64                   `json:"ordinal"`
	TaskType             string                  `json:"task_type"`
	WorkerID             string                  `json:"worker_id"`
	CreatedAt            time.Time               `json:"created_at"`
	StartedAt            *time.Time              `json:"started_at,omitempty"`
	FinishedAt           *time.Time              `json:"finished_at,omitempty"`
	InputHash            string                  `json:"input_hash"`
	Metadata             json.RawMessage         `json:"metadata,omitempty"`
	Input                json.RawMessage         `json:"input,omitempty"`
	Attempt              int                     `json:"attempt,omitempty"`
	MaxAttempts          int                     `json:"max_attempts,omitempty"`
	NextAttemptAt        *time.Time              `json:"next_attempt_at,omitempty"`
	BackoffMillis        int64                   `json:"backoff_ms,omitempty"`
	Retryable            *bool                   `json:"retryable,omitempty"`
	InputRef             *jobdb.InputReference   `json:"input_ref,omitempty"`
	RunPolicy            *jobdb.RunPolicy        `json:"run_policy,omitempty"`
	Prerequisites        []jobdb.JobPrerequisite `json:"prereqs,omitempty"`
}

type SchedulerPayload

type SchedulerPayload struct {
	RunPolicy jobdb.RunPolicy
	TaskWait  *TaskWait
}

func DecodeSchedulerPayload

func DecodeSchedulerPayload(raw []byte) (SchedulerPayload, error)

func DecodeSchedulerPayloadJSON

func DecodeSchedulerPayloadJSON(raw json.RawMessage) (SchedulerPayload, error)

type TaskWait

type TaskWait struct {
	InputStep  int64
	OutputStep int64
	Next       string
	InputHash  string
}

Jump to

Keyboard shortcuts

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