Help us shape the future of Go! Take the 2026 Go Developer Survey

runtimeexecutordispatch

package
v0.53.1 Latest Latest
Warning

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

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

Documentation

Overview

Package runtimeexecutordispatch routes an already-authorized shared runtime request across exact opaque execution channels. It owns no transport, endpoint discovery, credentials, provider lifecycle, or product policy.

Index

Constants

View Source
const (
	// ScopeChannel is one execution-channel child of a Dispatcher.
	ScopeChannel = "channel"
	// ScopeOwner is one runtime-owner child of an OwnerRouter.
	ScopeOwner = "owner"
)

Scope names the routing level of a prepared child.

View Source
const (
	OwnerStarted   = "started"
	OwnerRunning   = "running"
	OwnerSucceeded = "succeeded"
	OwnerFailed    = "failed"
)

Owner event statuses are the rollout-event statuses a progress consumer already understands: the lifecycle of one child is started, then repeated running liveness events, then exactly one of succeeded or failed.

View Source
const DefaultOwnerLivenessInterval = 15 * time.Second

DefaultOwnerLivenessInterval is the cadence of OwnerRunning events while one child executes, when the observer does not choose another.

Variables

This section is empty.

Functions

func OperationStateForSteps

func OperationStateForSteps(steps []runtimeapply.StepSnapshot) runtimeapply.OperationState

OperationStateForSteps derives the operation state a journal must report for a step set. A failure is terminal only once nothing is left to attempt: while other independent steps are still pending or running, the operation keeps running so they can be tried. This mirrors the shared contract, which admits a failed step in a running snapshot but requires a settled failure to be reported as reconcile-required.

Every journal implementation must derive the same state from the same steps, so this is the one place the rule lives.

func WithOwnerObserver added in v0.53.1

func WithOwnerObserver(ctx context.Context, observer OwnerObserver, interval time.Duration) context.Context

WithOwnerObserver attaches a request-scoped observer to ctx. A non-positive interval selects DefaultOwnerLivenessInterval.

Types

type Dispatcher

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

Dispatcher is a provider-neutral composite executor. Every child invocation is re-sealed and independently verified through runtimeexecutor.Invoke.

func New

func New(identity runtimeexecutor.ExecutorIdentity, routes []Route) (*Dispatcher, error)

func NewWithJournal

func NewWithJournal(identity runtimeexecutor.ExecutorIdentity, routes []Route, journal runtimeapply.Journal) (*Dispatcher, error)

NewWithJournal fixes a durable provider-neutral operation journal at construction. Apply callers cannot supply or replace it.

func (*Dispatcher) Execute

func (d *Dispatcher) Execute(ctx context.Context, request runtimeexecutor.ExecutionRequest) (runtimeexecutor.ExecutionOutcome, error)

func (*Dispatcher) Identity

func (d *Dispatcher) Identity() runtimeexecutor.ExecutorIdentity

type OwnerEvent added in v0.53.1

type OwnerEvent struct {
	Scope    string
	Label    string
	Module   string
	Workload string
	// Position is the 1-based place of the child in the serial execution order.
	Position int
	Total    int
	Targets  int
	Status   string
	// Elapsed is the time since the child started; zero on OwnerStarted and on
	// a replayed child.
	Elapsed time.Duration
	// Replayed reports a child whose durable result was reused and not run.
	Replayed bool
	// Degraded reports a failed child that only reported degraded units.
	Degraded    bool
	FailureCode runtimeapply.FailureCode
	Err         error
}

OwnerEvent is one observation of one prepared child. It carries identities and timing only: no request payload, artifact, command line, path or error text. Err is the typed cause of a failed child for the receiver to classify; it is not meant for serialization.

type OwnerObserver added in v0.53.1

type OwnerObserver func(OwnerEvent)

OwnerObserver receives the lifecycle of prepared children. It is called from the executing goroutine and, for liveness events, from a second goroutine while a child runs, so it must be safe for concurrent use and must return quickly. A panic inside it never reaches the Apply.

type OwnerRoute

type OwnerRoute struct {
	Target       runtimeexecutor.RuntimeTarget
	Executor     runtimeexecutor.Executor
	Compensation runtimeapply.CompensationMode
}

OwnerRoute binds one complete, already-verified RuntimeTarget to one typed executor selected by the product integration. Target is the authority selector: matching only an owner name, module, or requirement ID would allow contract, node, workload, artifact, or access authority substitution.

OwnerRoute contains no endpoint, credential, provider lifecycle, lease, or transport configuration. Remote execution remains the responsibility of an outer execution-channel dispatcher selected by the owning control plane.

type OwnerRouter

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

OwnerRouter dispatches the independently executable owners on one exact execution channel. All target mappings and child requests are prepared before the first child is invoked. When constructed with a Journal, durable idempotency and resume are fixed at the router boundary.

func NewOwnerRouter

func NewOwnerRouter(identity runtimeexecutor.ExecutorIdentity, routes []OwnerRoute) (*OwnerRouter, error)

NewOwnerRouter fixes the exact target-to-owner mapping at construction. Apply request callers cannot choose or replace a child executor.

func NewOwnerRouterWithJournal

func NewOwnerRouterWithJournal(identity runtimeexecutor.ExecutorIdentity, routes []OwnerRoute, journal runtimeapply.Journal) (*OwnerRouter, error)

NewOwnerRouterWithJournal fixes a durable provider-neutral operation journal at construction. Apply callers cannot supply or replace it.

func (*OwnerRouter) Execute

func (r *OwnerRouter) Execute(ctx context.Context, request runtimeexecutor.ExecutionRequest) (runtimeexecutor.ExecutionOutcome, error)

func (*OwnerRouter) Identity

func (r *OwnerRouter) Identity() runtimeexecutor.ExecutorIdentity

type ReconcileRequiredError

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

ReconcileRequiredError is the provider-free structured partial-failure result. It exposes only the exact validated operation and durable snapshot; adapter payloads, logs, endpoints, credentials, and provider handles are not part of either shared contract.

func (*ReconcileRequiredError) Critical

func (e *ReconcileRequiredError) Critical() bool

Critical reports whether the failure stopped the rollout. A critical failure abandons the remaining steps, so the durable snapshot shows work that was never attempted; a non-critical one means every step was attempted and the snapshot is the complete record of what this Apply achieved.

func (*ReconcileRequiredError) Error

func (e *ReconcileRequiredError) Error() string

func (*ReconcileRequiredError) Operation

func (e *ReconcileRequiredError) Operation() runtimeapply.Operation

Operation returns a defensive copy of the exact registered child authority.

func (*ReconcileRequiredError) Snapshot

func (e *ReconcileRequiredError) Snapshot() runtimeapply.Snapshot

Snapshot returns a defensive copy of the validated reconcile-required state.

func (*ReconcileRequiredError) Unwrap

func (e *ReconcileRequiredError) Unwrap() error

type Route

type Route struct {
	ChannelRef   string
	Executor     runtimeexecutor.Executor
	Compensation runtimeapply.CompensationMode
}

Route binds one opaque plan-owned channel identity to one executor selected by the owning control plane. ChannelRef is not an endpoint or credential.

Jump to

Keyboard shortcuts

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