wire

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package wire defines the envelope and subject conventions shared with the SDKs. The Envelope shape must stay in sync with the TS side (sdk/ts/src/envelope.ts).

Index

Constants

View Source
const (
	OpSpawn = "spawn"
	OpStop  = "stop"
)

Runtime supervision ops carried in a ctl envelope's Op field on the LordCtl channel (thrall -> lord). SpawnSpec is the payload for OpSpawn; StopSpec for OpStop.

View Source
const Events = "aether._lord.events"

Events = lifecycle stream (started/crashed/restarted) for the dashboard.

Variables

This section is empty.

Functions

func Call

func Call(app, name string) string

Thrall addressing: aether.<app>.<name>.<verb>

func Cast

func Cast(app, name string) string

func Ctl

func Ctl(name string) string

Supervision channels (lord <-> thrall): aether._lord.<name>.<verb>

func Data

func Data(app, name string) string

Data = wildcard across call/cast/info; a thrall puts a single subscription on it (one iterator = FIFO order, i.e. a serialized mailbox).

func EventLog

func EventLog(app, name string) string

EventLog = subject a thrall appends event-sourcing events to (opt-in). Unlike the WorkQueue mailbox, these are captured by a separate RETENTION stream (EventLogStream) and are therefore replayable in init to rebuild state ("log is truth, state is a projection").

Note: this subject is under the mailbox wildcard Data (`aether.<app>.<name>.*`), so a non-durable thrall receives its own appended events back on its data subscription; the mailbox dispatch ignores the "evt" verb (only call/cast are handled), so it is harmless - just a small self-echo. Durable thralls do not have the wildcard subscription and are unaffected.

func EventLogStream

func EventLogStream(app, name string) string

EventLogStream = name of the retention JetStream stream backing a thrall's event log.

func Heartbeat

func Heartbeat(name string) string

func HeartbeatAll

func HeartbeatAll() string

HeartbeatAll = wildcard for the lord to listen to heartbeats of all thralls.

func Info

func Info(app, name string) string

func LordCtl

func LordCtl() string

LordCtl = the lord's inbound control channel (thrall -> lord), request/reply. Unlike Ctl (lord -> thrall), this is where a thrall asks the lord to spawn or stop a child at runtime (a ctl envelope with Op "spawn" | "stop").

func Stream

func Stream(app, name string) string

Stream = name of the JetStream stream for a thrall's durable mailbox. Dots are not allowed in stream names, hence underscores (app/name do not contain them).

Types

type Envelope

type Envelope struct {
	V  int    `json:"v"`
	ID string `json:"id,omitempty"`
	// Trace is a correlation id propagated across hops (call/cast chains), distinct from ID
	// which correlates a single request with its reply. It lets one logical operation be
	// followed across process boundaries; an edge (CLI, first message) mints it, handlers pass
	// it to downstream calls, and it is logged so a trace and a log line can be joined.
	Trace   string          `json:"trace,omitempty"`
	Kind    Kind            `json:"kind"`
	From    string          `json:"from,omitempty"`
	To      string          `json:"to,omitempty"`
	Op      string          `json:"op,omitempty"`
	Payload json.RawMessage `json:"payload,omitempty"`
	Status  string          `json:"status,omitempty"` // reply: "ok" | "error"
	Error   *WireError      `json:"error,omitempty"`
	TS      int64           `json:"ts,omitempty"`
}

Envelope is the uniform JSON envelope for all communication in the ether.

type HeartbeatMetrics

type HeartbeatMetrics struct {
	MailboxDepth     int     `json:"mailbox_depth"`
	MailboxLatencyMs float64 `json:"mailbox_latency_ms"`
	ProcessedTotal   uint64  `json:"processed_total"`
}

HeartbeatMetrics are a thrall's self-reported runtime samples, carried in the payload of a heartbeat envelope. The lord aggregates them into the /metrics exposition. Field order is part of the wire contract - the TS and Python SDKs mirror it exactly.

mailbox_depth is the number of messages the thrall currently holds (received, handler not yet returned); mailbox_latency_ms is the duration of the most recent handler (including the wait for the serialized mailbox lock); processed_total is the cumulative count of handled messages since the thrall started (it resets on restart, like any process-local counter).

type Kind

type Kind = string

Kind distinguishes the message type on the wire.

const (
	KindCall  Kind = "call"
	KindCast  Kind = "cast"
	KindReply Kind = "reply"
	KindHB    Kind = "hb"
	KindCtl   Kind = "ctl"
)

type SpawnReply

type SpawnReply struct {
	Name string `json:"name"`
}

SpawnReply is the reply payload for a successful spawn.

type SpawnSpec

type SpawnSpec struct {
	Name     string `json:"name"`
	Cmd      string `json:"cmd"`
	Restart  string `json:"restart,omitempty"`   // permanent | transient | temporary (default permanent)
	Durable  bool   `json:"durable,omitempty"`   // true -> casts go through JetStream
	EventLog bool   `json:"event_log,omitempty"` // true -> provision an event-sourcing log for Append/Rebuild
}

SpawnSpec is the request payload to start a child at runtime - the subset of a manifest thrall relevant to a dynamic child. A dynamic child is always local scope and single instance; Replicas and Scope are not part of the runtime API.

type StopSpec

type StopSpec struct {
	Name string `json:"name"`
}

StopSpec is the request payload to stop a child at runtime.

type WireError

type WireError struct {
	Type      string `json:"type"`
	Message   string `json:"message"`
	Retryable bool   `json:"retryable"`
}

WireError carries an error inside a reply message.

Jump to

Keyboard shortcuts

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