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
- func Call(app, name string) string
- func Cast(app, name string) string
- func Ctl(name string) string
- func Data(app, name string) string
- func EventLog(app, name string) string
- func EventLogStream(app, name string) string
- func Heartbeat(name string) string
- func HeartbeatAll() string
- func Info(app, name string) string
- func LordCtl() string
- func Stream(app, name string) string
- type Envelope
- type HeartbeatMetrics
- type Kind
- type SpawnReply
- type SpawnSpec
- type StopSpec
- type WireError
Constants ¶
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.
const Events = "aether._lord.events"
Events = lifecycle stream (started/crashed/restarted) for the dashboard.
Variables ¶
This section is empty.
Functions ¶
func Data ¶
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 ¶
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 ¶
EventLogStream = name of the retention JetStream stream backing a thrall's event log.
func HeartbeatAll ¶
func HeartbeatAll() string
HeartbeatAll = wildcard for the lord to listen to heartbeats of all thralls.
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 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.