package broker import "git.novox.be/novox/mesh-sdk/go/delivery" // The two modules that read the build seats' queues, each by name (novox/hq ADR 0525 ยง2, issue 1887 A8): the watchman hears // the asks put on the seats (a plain subscription, no consumer made) to mirror each waiting ask as a pulse, and the view // reads the shared workers' counts and the oldest waiting ask to show the backlog. Neither may publish an ask: only the // builder and the checker ask, by their seat use. Nothing here is a wildcard over a stream or a worker. const ( // ViewModule is the module of the delivery view (mesh-delivery-view). ViewModule = "mesh-delivery-view" ) // BuildSeatAsksHeard are the subjects the watchman subscribes to: `mesh.seat.node-build-.accept.` of every // build seat and kind (delivery.AskSubject), each by name. func BuildSeatAsksHeard() []string { var out []string for _, lang := range delivery.AskLanguages { for _, kind := range delivery.AskKinds { if s, err := delivery.AskSubject(lang, kind); err == nil { out = append(out, s) } } } return out } // BuildBacklogReads are the API subjects the view requests: the information of each build seat's stream and of each of its // shared workers (delivery.AskStream, delivery.AskWorker), and the message of the stream by sequence. Reads only: no // message is pulled, none acknowledged, none published. func BuildBacklogReads() []string { var out []string for _, lang := range delivery.AskLanguages { stream, err := delivery.AskStream(lang) if err != nil { continue } out = append(out, "$JS.API.STREAM.INFO."+stream, "$JS.API.STREAM.MSG.GET."+stream) for _, kind := range delivery.AskKinds { if w, err := delivery.AskWorker(lang, kind); err == nil { out = append(out, "$JS.API.CONSUMER.INFO."+stream+"."+w) } } } return out }