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

protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package protocol owns Restate handler identities, raw JSON and propagation.

Index

Constants

View Source
const (
	// RunHandler is the name of the workflow run handler.
	RunHandler = "Run"

	// SignalHandler is the name of the shared handler that resolves signals.
	SignalHandler = "Signal"

	// CancelHandler is the name of the shared handler that stops the local
	// attempt of a run.
	CancelHandler = "Cancel"

	// SignalPromise prefixes the durable promise of a signal.
	SignalPromise = "sig:"

	// RunningKey is the state key that is true while the Run handler runs.
	RunningKey = "running"

	// AlreadyCompleted is part of the message of the failure Restate gives
	// for a second resolve of a promise.
	AlreadyCompleted = "already completed"

	// InvocationTimeout is the inactivity and abort timeout of the Run
	// handler. It is generous so a long step is not aborted by the server
	// defaults; MaxDuration is enforced by the runtime, not by these.
	InvocationTimeout = 24 * time.Hour

	// SpawnSettle is the durable timer after a Spawn.
	SpawnSettle = time.Millisecond

	// MetadataHeader prefixes the headers that carry [workflow.StartOptions]
	// metadata.
	MetadataHeader = "arkoren-meta-"
)
View Source
const CodeCanceled = 409

CodeCanceled is the Restate failure code of a canceled invocation.

View Source
const TraceHeader = "arkoren-trace-"

TraceHeader separates propagation fields from the user metadata namespace. Restate persists these invocation headers across retries and suspension.

Variables

This section is empty.

Functions

func FromFailure

func FromFailure(code int, message string) error

FromFailure decodes the retained terminal envelope without numeric coercion.

func TraceCarrier

func TraceCarrier(ctx restatesdk.RunContext) map[string]string

TraceCarrier reads only the explicit start carrier, never attempt headers or arbitrary metadata. The result is owned by the caller and safe to forward.

func TraceHeaders

func TraceHeaders(carrier map[string]string) map[string]string

TraceHeaders encodes carrier fields into application-owned invocation headers. No telemetry runs here: spawn forwarding must be deterministic on replay.

Types

type Payload

type Payload []byte

Payload carries the facade bytes, which are always JSON, as a raw JSON value on the wire. Restate then sees plain application/json and a caller without the SDK can use the ingress.

func (Payload) MarshalJSON

func (value Payload) MarshalJSON() ([]byte, error)

MarshalJSON returns the bytes as they are, or null when empty.

func (*Payload) UnmarshalJSON

func (value *Payload) UnmarshalJSON(data []byte) error

UnmarshalJSON keeps a copy of the raw value.

type SignalRequest

type SignalRequest struct {
	// Name selects the application signal promise within the addressed workflow.
	// It is separate from the native Signal handler name used by the gateway.
	Name string `json:"name"`
	// Payload contains the opaque JSON value forwarded to application dispatch.
	Payload Payload `json:"payload"`

	// Force resolves the promise even when the run is not running yet, for
	// example while it waits for its delay.
	Force bool `json:"force,omitempty"`
}

SignalRequest is the input of the Signal handler.

Jump to

Keyboard shortcuts

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