events

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package events projects raw `stream` payloads from the console wire protocol into a canonical Row that drives the Monitor pane's table renderer. The waterfall renders a 3-column scan view (Time, Kind, ID); every other field of the server payload is preserved verbatim on Row.Payload so the Detail Panel below the waterfall can render the full record without truncation when a row is selected.

The "smart compact Kind" encodes verb + state + (entropy) source into a single dotted token so the row tells the operator what happened without needing a Details column. Examples:

block.created  with state=finalized          → "block.finalized"
item.created   with state=created            → "item"
item.updated   with state=processing         → "item.processing"
item.deleted                                  → "item.deleted"
entropy.created  source=entropy_nist          → "entropy.nist"
entropy.updated  source=entropy_stellar
                 state=failed                 → "entropy.stellar.failed"
item.burst                                    → "item.burst"
entropy.burst    stream=entropy.bitcoin       → "entropy.bitcoin.burst"
block_healing.forward                         → "block_healing.forward"
server.down / server.up                       → unchanged

The original server kind is preserved on Row.RawKind for the panel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Push

type Push struct {
	Stream string          `json:"stream"`
	Kind   string          `json:"kind"`
	At     string          `json:"at"`
	Data   json.RawMessage `json:"data"`
}

Push mirrors the wire shape produced by ConsoleProjector + ConsoleChannel.push_stream/4.

type Row

type Row struct {
	When       time.Time // server emit time (parsed from Push.At, falls back to ReceivedAt)
	ReceivedAt time.Time // local receive time — used for "(received +Nms)" skew display
	Kind       string    // compact display kind (e.g. "entropy.nist.failed")
	RawKind    string    // original server kind (e.g. "entropy.updated")
	ID         string    // full ULID/UUID, count for bursts, duration for outages
	Stream     string    // original stream id (e.g. "commitments.internal")
	Severity   Severity
	Payload    map[string]any // full decoded server payload (Push.Data) — used by Detail Panel
}

Row is the canonical event the Monitor table renders. The waterfall uses Time / Kind / ID; the Detail Panel uses RawKind / Stream / At plus every field of Payload.

func Outage

func Outage(at time.Time, since time.Time, closing bool) Row

Outage builds a synthetic Row for a connection outage marker. The duration is rendered in the ID column so the row fits the canonical 3-column shape; the panel renders the prose context.

func Project

func Project(now time.Time, p Push) Row

Project converts a Push into a Row. `now` is the local receive time used as a fallback when the server's `at` field is missing or unparseable, and as the ReceivedAt anchor for skew display in the Detail Panel.

type Severity

type Severity int

Severity classifies a row's visual treatment. Normal rows render in the resource's accent color; Burst rows get a dim count badge in the ID column; Outage rows render in the error color and italic.

const (
	SeverityNormal Severity = iota
	SeverityBurst
	SeverityOutage
)

Jump to

Keyboard shortcuts

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