topics

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 10 Imported by: ? 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 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 customer joins a topic in the portal; the broker projects it and the edge picks it up on its next snapshot poll, with no converge and 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 customer's 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(name string) [32]byte

ID is the projected topic id: SHA-256 of the topic NAME. The broker projects it so the edge never needs names, which is why a bridge holding names has to derive it to compare at all.

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

func Compare(bridged []string, subscribedIDs []string, allTopics bool) Diff

Compare diffs the bridge's own names against the consumer's projected ids.

It compares IDS, not names, because ids are what the broker actually projects and what the edge filters on. Comparing names would agree with a broker that had renamed a topic under the same id, which is precisely the case worth catching.

func (Diff) Describe

func (d Diff) Describe() string

Describe renders the diff for a log line.

func (Diff) OK

func (d Diff) OK() bool

OK reports whether anything is being dropped.

type Subscription

type Subscription struct {
	TopicIDs  []string
	AllTopics bool
}

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 projected subscription from the broker's state API.

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 broker was briefly unreachable would convert a control-plane blip into a data-plane outage.

Jump to

Keyboard shortcuts

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