The mesh runs on the seat's bus alone (novox/hq ADR 0131, design 28 task 5.5). The old transport's consume loop, build request, tool ask, management API and account scoping are deleted, and the bus switch with them; the controller connects to the broker seat and to nothing else. The store-window tests keep their assertions on a bus-less fake, and the tests that only made sense for the old transport's in-memory holding go with it.
24 lines
880 B
Go
24 lines
880 B
Go
package link
|
|
|
|
import (
|
|
"github.com/novox/mesh-controller/internal/broker"
|
|
)
|
|
|
|
// ConnectNats is Connect for the bus being built: the controller's inbound and outbound over one
|
|
// JetStream connection the caller has already raised the streams on. Nothing is declared here —
|
|
// the streams and the controller's consumers are asserted by Raise, before anything is served.
|
|
func ConnectNats(js *broker.JetStream, enroller Enroller, listener Listener) *Server {
|
|
return &Server{
|
|
inbound: Nats(js),
|
|
bus: OverNATS{JS: js.Context(), Conn: js.Conn()},
|
|
js: js,
|
|
enroller: enroller,
|
|
listener: listener,
|
|
log: newLog(),
|
|
}
|
|
}
|
|
|
|
// Bus is the controller's outbound, whichever transport it connected over. Callers that send a
|
|
// declaration or ask a tool use this rather than the channel, which one transport does not have.
|
|
func (s *Server) Bus() Bus { return s.bus }
|