package buscompose import ( "git.novox.be/novox/mesh-sdk/go/asks" "git.novox.be/novox/mesh-sdk/go/catalogue" ) // The node seat node-engine (novox/hq ADR 0563 §1): every node's engine holds it on its own bus account, and no module // claims it. Its verbs and events are the catalogue's (catalogue.EngineVerbs), read here rather than copied. // EngineSeat is the seat. const EngineSeat = catalogue.EngineSeat // engineGrants is what a node's engine is granted to hold its node seat and to ask the operator (ADR 0563 §1, §3): it // answers its own node's verbs (the caller-named subjects are added beside them with every principal's), says the // seat's events about its node, answers discovery for the seat, asks who answers what (the login shell's execute, ADR // 0563 §6), and asks the operator under asks.EngineAsker(node) on the router's seat as its holder declares it, as any // user of that seat is granted. func engineGrants(p Principal) (pub, sub []string) { for _, v := range catalogue.EngineVerbs() { sub = append(sub, "mesh.seat."+EngineSeat+".tool."+v.Name+"."+p.Node) } for _, e := range catalogue.EngineEvents { pub = append(pub, "mesh.seat."+EngineSeat+".event."+e+"."+p.Node) } sub = append(sub, announcing(EngineSeat)...) pub = append(pub, discovering()...) tp, ts := seatTrafficGrants(SeatTrafficOf(asks.EngineAsker(p.Node), nil, p.Uses, nil)) return append(pub, tp...), append(sub, ts...) }