Describe the bus on its own terms

Comments framed the new bus by what it replaces — a comparison in almost
every explanation, which reads as though NATS were a variant of the old
thing rather than the mesh's nervous system. Removed throughout, and
OverAMQP becomes OverCurrent: the seam's two sides are the bus the mesh
runs on today and the one being built, not two protocols.

What remains is the client library's own package name, which is its name.
This commit is contained in:
2026-09-26 23:51:00 +02:00
parent 92d87b0082
commit 6c12780abe
5 changed files with 27 additions and 32 deletions
+12 -13
View File
@@ -12,15 +12,14 @@ import (
// Bus is what the controller needs of the mesh's bus, **in the mesh's own words rather than a
// transport's** (novox/hq ADR 0116 step 3).
//
// Until now every one of these functions took an `*amqp.Channel`, so the transport reached every
// caller and swapping it meant touching all of them. The seam is small — the controller sends
// exactly two kinds of message that expect no answer, and asks two kinds of question — which is
// why the bus could be replaced at all.
// Until now every one of these functions took the transport's own channel type, so the transport
// reached every caller and changing it meant touching all of them. The seam is small — the
// controller sends exactly two kinds of message that expect no answer, and asks two kinds of
// question — which is why the bus can be replaced at all.
//
// Two implementations live below. Both ship: steps 1 to 4 leave every node on AMQP
// ([ADR 0116](novox/hq)), so the controller keeps speaking it and the NATS one is selected at the
// rollout. That is also what makes them comparable — the same caller, the same arguments, and a
// conformance fixture holding both to one envelope.
// Two implementations live below, and both ship until the rollout (ADR 0116: nothing moves a
// node's bus before step 5). Both shipping is what makes them comparable — the same caller, the
// same arguments, and one conformance fixture holding them to one envelope.
type Bus interface {
// PublishEvent announces something that happened, under the emitter's own name. 1:many, and
// nobody is obliged to act (ADR 0041).
@@ -32,12 +31,12 @@ type Bus interface {
PublishDeclaration(ctx context.Context, node string, body []byte) error
}
// --- AMQP, the bus the mesh runs on today -----------------------------------------------------
// --- The bus the mesh runs on today -----------------------------------------------------
// OverAMQP is the bus as a channel.
type OverAMQP struct{ Channel *amqp.Channel }
// OverCurrent is the bus the mesh runs on today, until the rollout.
type OverCurrent struct{ Channel *amqp.Channel }
func (b OverAMQP) PublishEvent(ctx context.Context, key, source, node string, body []byte) error {
func (b OverCurrent) PublishEvent(ctx context.Context, key, source, node string, body []byte) error {
id, err := eventID()
if err != nil {
return err
@@ -58,7 +57,7 @@ func (b OverAMQP) PublishEvent(ctx context.Context, key, source, node string, bo
})
}
func (b OverAMQP) PublishDeclaration(ctx context.Context, node string, body []byte) error {
func (b OverCurrent) PublishDeclaration(ctx context.Context, node string, body []byte) error {
// To the queue directly rather than through an exchange: a declaration is for one node, and
// routing it by name through a shared exchange would mean a binding per node that nothing
// removes when a node is retired.
+1 -1
View File
@@ -631,7 +631,7 @@ func (s *Server) catchingUp(ctx context.Context, delivery amqp.Delivery) {
sent := 0
for _, a := range announcements {
a.Replay = true
if err := EmitEvent(ctx, OverAMQP{Channel: s.channel}, KeyModuleBuilt, "control-plane", "", a); err != nil {
if err := EmitEvent(ctx, OverCurrent{Channel: s.channel}, KeyModuleBuilt, "control-plane", "", a); err != nil {
// Said and abandoned rather than retried: the catalogue asks again every time it
// starts, and half a graph delivered twice is no better than half delivered once.
s.log.Printf("replaying %s at %s failed, and the rest is abandoned: %v",