The mesh's own roles carry a protocol, and the build branch retires
ADR 0121, first half. The `mesh-*` seats said who does a job and nothing about what may be said to them or by them, so the mesh had roles it could not describe. They take the same three fields a module's seat has now, and the machinery that already derives a work queue, a holder's worker and a permission set from a declared seat does it for these too. The build-machine role accepts a build and emits an outcome, so `mesh.build.request`, `mesh.control.built` and the BUILDS stream are gone. A work queue shared by several build machines is what a seat's `accepts` already is, and keeping a second mechanism for it was two places a permission could be wrong. The controller's own side of a seat is a named list rather than something derived: it is not a module and declares no `uses`, so which roles the mesh itself submits work to has to be stated — and stating it makes that question answerable. Two things this caught: **The followed event subjects were hard-coded and had just gone stale.** They were written out while the catalogue still spelled its events as the old bus's routing keys, so converting those (issue 127) turned the pair into a controller listening to a subject nothing publishes — the same fault as the issue, from the other side. They derive from the emitter and the event name now, through the same function the permission uses, so the two cannot drift apart. **A role's queue exists before its holder**, checked against a real server, and asserting twice changes nothing. Work queues until somebody arrives to do it, so assigning a build machine later flushes the backlog instead of having lost it.
This commit is contained in:
@@ -27,6 +27,17 @@ type Seat struct {
|
||||
// provision may only be held by a module providing it at the seat's scope, and its holder is
|
||||
// what a requirement for that provision resolves to when several modules provide it.
|
||||
Delivers string
|
||||
// Accepts, Emits and Serves are the protocol of the role, as local verbs — the same three a
|
||||
// module declares for a seat of its own (novox/hq ADR 0118), and empty for most of these: a seat
|
||||
// is usually about who does a job and not about what may be said to them.
|
||||
//
|
||||
// **Named here so the mesh has no role it cannot describe** (ADR 0121). Without them a build
|
||||
// machine had three audiences for one outcome and nothing derived a grant for any of them, and an
|
||||
// event about a role had nowhere to live but the namespace of whichever module held that role
|
||||
// today — which the bus refuses, because a namespace belongs to who it is named for.
|
||||
Accepts []string
|
||||
Emits []string
|
||||
Serves []string
|
||||
// Decision is the record that made it a seat.
|
||||
Decision string
|
||||
}
|
||||
@@ -53,7 +64,12 @@ var seats = []Seat{
|
||||
{Name: "mesh-catalog", Scope: ScopeMesh, Decision: "novox/hq ADR 0110"},
|
||||
{Name: "mesh-npm-package-registry", Scope: ScopeMesh, Delivers: "npm-package-registry", Decision: "novox/hq ADR 0109"},
|
||||
{Name: "mesh-git", Scope: ScopeMesh, Delivers: "git", Decision: "novox/hq ADR 0111"},
|
||||
{Name: "mesh-build-machine", Scope: ScopeNode, Decision: "novox/hq ADR 0110"},
|
||||
// A build is work submitted to this role, and its outcome is the role's own event (ADR 0121).
|
||||
// One publish reaches whoever asked, the controller that records it, and the catalogue that
|
||||
// places it in the module graph — which is what the old bus's shared exchange did for free, and
|
||||
// what a dedicated build branch was doing a second way.
|
||||
{Name: "mesh-build-machine", Scope: ScopeNode,
|
||||
Accepts: []string{"build"}, Emits: []string{"built"}, Decision: "novox/hq ADR 0110"},
|
||||
{Name: "mesh-dns-port", Scope: ScopeNode, Decision: "novox/hq ADR 0110"},
|
||||
{Name: "mesh-intrusion-prevention", Scope: ScopeNode, Decision: "novox/hq ADR 0110"},
|
||||
{Name: "mesh-packet-filter", Scope: ScopeNode, Decision: "novox/hq ADR 0110"},
|
||||
@@ -197,3 +213,18 @@ var renamedSeats = map[string]string{
|
||||
"the-resolver-configuration": "mesh-resolver-configuration",
|
||||
"the-showcase": "mesh-showcase",
|
||||
}
|
||||
|
||||
// SeatsWithAProtocol are the mesh's own seats that say something about what may be said to them or by
|
||||
// them, which is the set the bus derives streams, consumers and permissions from.
|
||||
//
|
||||
// Most of the set is not here, and that is the ordinary case: a seat saying only who does a job grants
|
||||
// nothing on the bus and needs no queue.
|
||||
func SeatsWithAProtocol() []Seat {
|
||||
var out []Seat
|
||||
for _, s := range seats {
|
||||
if len(s.Accepts) > 0 || len(s.Emits) > 0 || len(s.Serves) > 0 {
|
||||
out = append(out, s)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user