33 lines
1.3 KiB
Go
33 lines
1.3 KiB
Go
package catalogue
|
|
|
|
import contractseats "git.novox.be/novox/mesh-contracts/go/seats"
|
|
|
|
// EngineSeat is the node seat every node's engine holds, from the seat set. The seat is defined whole in mesh-contracts
|
|
// (its contract, go/seats/nodeengine, and its client, go/clients/nodeengineclient): its verbs' and events' names and
|
|
// message types are taken from there (ADR 0627 §4).
|
|
const EngineSeat = contractseats.NodeEngine
|
|
|
|
// EngineVerbs are the node-engine seat's verbs, in the order ADR 0563 §1 names them: its definition's, read from the
|
|
// generated seat list (design 26), each with its description and its input's schema as discovery shows them.
|
|
func EngineVerbs() []Verb {
|
|
s, _ := seatIn(defaultSeats, EngineSeat)
|
|
return append([]Verb(nil), s.Serves...)
|
|
}
|
|
|
|
// EngineEvents are what the seat says: of an act, each naming the act, the path or access, the caller as the runtime
|
|
// proved it and the ask (ADR 0563 §1), and that what its engine reads of a manifest changed (ADR 0618 §4).
|
|
var EngineEvents = func() []string {
|
|
s, _ := seatIn(defaultSeats, EngineSeat)
|
|
return append([]string(nil), s.Emits...)
|
|
}()
|
|
|
|
// seatIn is the seat of that name in a list.
|
|
func seatIn(list []Seat, name string) (Seat, bool) {
|
|
for _, s := range list {
|
|
if s.Name == name {
|
|
return s, true
|
|
}
|
|
}
|
|
return Seat{}, false
|
|
}
|