Documentation
¶
Overview ¶
Package topics reconciles the bridge's elected topic list against what its consumer is actually subscribed to.
The gap this closes is a quiet one. A topic joined at the consumer's subscription source reaches the delivery edge with no restart. The bridge's `-topics` is a PROCESS FLAG and does not follow. So the plane starts delivering a topic the bridge then discards, and every component reports itself healthy: the election is live, the edge joined the band, the frames arrive here, and the objects die one hop before they would have been useful.
At runtime that shows up as a rising unknown_topic counter, which an alert watches. This is the same fact one step earlier, at startup, where an operator who just restarted the unit is actually looking.
It WARNS AND CONTINUES, never refuses. Refusing would turn a topic join into a bridge that will not start, which is a worse outage than a topic that is not bridged: the un-bridged topic loses one topic's objects, the refusal loses all of them.
The subscription source is any HTTP service that answers the contract in docs/contracts.md ("The subscription source"); Fetch is its client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Diff ¶
type Diff struct {
// Subscribed but NOT bridged. These objects arrive and are discarded.
// This is the direction that loses data.
Missing []string
// Bridged but NOT subscribed. Harmless: nothing is delivered for them, so
// the flag is merely wider than the election. Reported anyway, because it
// is usually a leftover from a topic somebody left and it makes the flag
// misleading to read.
Extra []string
// AllTopics reports the aggregator posture, in which the consumer receives
// every topic on the plane and no finite -topics list can match it.
AllTopics bool
}
Diff is what the bridge carries versus what its consumer is subscribed to.
func Compare ¶
Compare diffs the bridge's own names against the consumer's subscribed topic identifiers.
It compares IDENTIFIERS, not names, because the identifier is what the edge filters on and what a delivery record carries, so a source that answers names and one that answers identifiers are judged on the same terms.
type Subscription ¶
Subscription is the slice of a consumer record this check reads.
func Fetch ¶
func Fetch(ctx context.Context, base, consumerID, token string, hc *http.Client) (Subscription, error)
Fetch reads one consumer's subscription from a subscription source: GET {base}/v1/state, with token (when set) as a bearer credential, and the first entry in "consumers" whose "id" is consumerID. The contract is in docs/contracts.md ("The subscription source"); any service can implement it.
Read-only and best-effort by design: every failure here is reported to the caller and none of them is fatal, because a bridge that refused to start when the source was briefly unreachable would convert a control-plane blip into a data-plane outage.