Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acceptance ¶ added in v0.2.31
Acceptance is the trusted routing outcome at the moment the chassis commits to running a tenant's stack: the pinned tenant and the stack the boot handoff routed into, read from immutable pipeline state (processor.TenantObserver), never from the envelope.
type DispatchResult ¶ added in v0.2.31
type DispatchResult struct {
Payload Payload
Tenant string // "" or "_sys": the run never left the system tenant
Stack string // the routed stack; "" when unrouted
// Ingress and HostnameVerified are the rest of the route the boot
// handoff promoted (`_txc.ingress`, `_txc.hostname_verified`), so an
// inlet that pins a connection can pre-stamp the same route on the
// connection's later events.
Ingress string
HostnameVerified bool
Err error // pipeline error, if any
}
DispatchResult is the bus loop's trusted summary of one run: the final payload plus the tenant and stack the chassis pinned — read from immutable pipeline state (processor.TenantObserver), never parsed out of the author-visible envelope, whose `_txc.tenant` a stack could rewrite. An inlet that needs the routing outcome (the TCP head deciding whether a connection stays open) sets Envelope.ResultCh and leaves ResCh nil.
type Envelope ¶
type Envelope struct {
Ctx context.Context
Payload *Payload
ResCh chan Payload
// ResultCh, when set, replaces ResCh: the bus loop answers once with
// the run's DispatchResult (final payload + trusted tenant/stack)
// after the pipeline returns. Streaming responses need ResCh.
ResultCh chan DispatchResult
// Accepted, when set, is told once — before the tenant's stack runs
// — that the chassis has accepted this event for execution: routed
// out of _sys/boot into a concrete tenant and admitted. An inlet that
// delivers from a durable outbox closes its claim on this signal
// rather than at completion, so a long run never holds a delivery
// claim open. The send is non-blocking: buffer the channel at 1. It
// is never sent for a run that stays in _sys, or for one admission
// denies (those answer on ResCh/ResultCh as before).
Accepted chan Acceptance
Rid string
Src string
}
type OpsHandler ¶
type OpsHandlerFunc ¶
type OpsHandlerFunc func(ctx context.Context, opName string, in []byte, out []byte) (Payload, error)
OpsHandlerFunc adapts a plain function to the OpsHandler interface, in the same shape as http.HandlerFunc. Built-in core ops (e.g. txco://noop) are registered as OpsHandlerFunc values.
type Payload ¶
type Payload struct {
Raw string `json:"raw,omitempty"`
Type Type `json:"type,omitempty"`
Meta string `json:"meta,omitempty"`
}
func CreateJSONPayload ¶
type Type ¶
type Type int
Event payloads may have different types
const ( // Null is an empty message, an ACK Null Type = iota // JSON is a raw block of JSON JSON // Error ErrorStr // StreamHead carries the response status + headers snapshot for a // streamed HTTP response. Sent once, before any StreamChunk; the // response writer writes the head and switches into incremental-flush mode. StreamHead // StreamChunk carries a block of raw (already-decoded) response body // bytes in Raw, to be written and flushed immediately. StreamChunk // StreamEnd terminates a streamed response. No body; the response writer // returns once it receives this. StreamEnd )