mesh-sdk: Account.BusSubject names the subject of a template stream (A-41)

Builds: design 42 zfs-owns-zfs A-41
This commit is contained in:
2026-11-13 01:29:59 +01:00
parent b54d20ac5a
commit f84fe54c6c
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -265,6 +265,7 @@ func TestModuleAccountNamesAndDialOptions(t *testing.T) {
for _, c := range []struct{ name, got, want string }{
{"event subject", a.EventSubject("put"), "mesh.mod.mesh-delivery-teller.event.put"},
{"own stream subject", a.StreamSubject("forge.x.pull"), "mesh.stream.mesh-delivery-teller.event.forge.x.pull"},
{"template stream subject", a.BusSubject("events", "snapshot.taken.person"), "mesh.bus.mesh-delivery-teller.events.snapshot.taken.person"},
{"another module's stream subject", ModuleStreamSubject("mesh-delivery-checker", "check"), "mesh.stream.mesh-delivery-checker.event.check"},
{"durable consumer", a.EventConsumerName(), "n1_mesh-delivery-teller"},
} {
+6
View File
@@ -71,6 +71,12 @@ func (a Account) EventSubject(event string) string { return "mesh.mod." + a.Modu
// (mesh-controller internal/broker/modstreams.go ModuleStreamSubject).
func (a Account) StreamSubject(event string) string { return ModuleStreamSubject(a.Module, event) }
// BusSubject is where the module's event lands on a stream it asked for by template: mesh.bus.<module>.<local>.<event>,
// <local> being the stream's local name in the module's `requires` (the bus module's keeper, PlanOf; A-41).
func (a Account) BusSubject(local, event string) string {
return "mesh.bus." + a.Module + "." + local + "." + event
}
// ModuleStreamSubject is where a module's event lands on that module's own stream, for a part that names another
// module's stream (the indexer hears the forge bridge's, the checker's) without holding its credential.
func ModuleStreamSubject(module, event string) string {