package broker import "git.novox.be/novox/mesh-sdk/go/delivery" // The view alone reads the build seats' queues (novox/hq ADR 0525 ยง2, issue 1887 A8a): the shared workers' counts and the // oldest waiting ask, to show the backlog. It may not publish an ask: only the builder and the checker ask, by their seat use. // The watchman is granted nothing here: a waiting ask has no pulse, a taken one is read from the build module's steps (issue // 1908). Nothing 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" // BuilderModule is the module of the builder (mesh-delivery-builder). BuilderModule = "mesh-delivery-builder" ) // BuildAskReads are the API subjects the builder requests when it takes over, at its start, a key naming an ask (issue // 1910): each build seat's stream's information and its messages by sequence, to tell whether the ask is on its stream. // Reads only: no consumer, no pull, no acknowledgement; the builder puts its asks by its seat use, as before. func BuildAskReads() []string { var out []string for _, lang := range delivery.AskLanguages { if stream, err := delivery.AskStream(lang); err == nil { out = append(out, "$JS.API.STREAM.INFO."+stream, "$JS.API.STREAM.MSG.GET."+stream) } } 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 }