Files
mesh-sdk/go/catalogue/catalog_seat.go
T
jschoubben cf5812101b
mesh/delivery-group group feat/l3b-bus checking: 4 of 4 member(s) ready
mesh/delivery closed: a newer head of the same pull request
mesh/check checking cf5812101b0b on 2341e8e98377 | novox/mesh-sdk#165 in group feat/l3b-bus
The seat mesh-catalog's verbs' answers are its contract: CatalogModules, CatalogOne, CatalogProvides and CatalogDependents, with the field names of the catalog module's tools they replace; the module graph is no part of mesh-sdk (the operator, 2026-11-03: only contracts)
2026-11-03 16:51:54 +01:00

82 lines
4.1 KiB
Go

package catalogue
import "encoding/json"
// CatalogSeat is the seat of the catalog: what the mesh holds of every module (novox/hq ADR 0604 §1). Its states are
// its holder's: the modules the trunk holds, their manifests by digest and the module graph (the indexer's states
// `modules`, `manifests` and `graph`), announced with who may read them; a reader that only watches reads them and calls
// no verb. It names no event. What must be built again is no verb: a module whose fingerprint differs from its newest
// build, which the delivery view derives. The verbs' answers are CatalogModules, CatalogOne, CatalogProvides and
// CatalogDependents, whose field names are those of the catalog module's tools they replace.
const CatalogSeat = "mesh-catalog"
// catalogVerbs are the seat's four verbs, each read from its holder's states. Each is optional until the holder that
// runs serves it (design 33 §7): the module that claimed the seat before serves none of them, and a judge holding them
// required would read it as outgrown for as long as both claims stand (novox/hq ADR 0604 §6).
func catalogVerbs() []Verb {
return []Verb{
{Name: "modules", Optional: true, Description: "Every module the trunk holds, each with its repository, its " +
"directory there, the merge commit it was last changed at and its fingerprint (or why it has none): the " +
"catalog of the mesh, read from its holder's state. Reads only.",
Input: schema(map[string]string{}, nil)},
{Name: "module", Optional: true, Description: "One module whole: its repository, directory, commit and " +
"fingerprint, and its manifest as the trunk holds it. Older versions are in its repository's history. Reads only.",
Input: schema(map[string]string{"module": "the module's name"}, []string{"module"})},
{Name: "provides", Optional: true, Description: "Which modules provide a provision (a module provides its own " +
"name too) and which require it, from the module graph's provision edges. Reads only.",
Input: schema(map[string]string{"provision": "the provision, such as postgres-database"}, []string{"provision"})},
{Name: "dependents", Optional: true, Description: "The modules whose build edges reach a module, directly or " +
"through others (a base, a mesh package it publishes, the build module that builds them): what a change of it " +
"builds again, from the module graph. Reads only.",
Input: schema(map[string]string{"module": "the module's name"}, []string{"module"})},
}
}
// CatalogEntry is one module of the catalog: its repository, its directory there ("." for the root), the merge commit it
// was last changed at, and its new-form fingerprint or why it has none.
type CatalogEntry struct {
Module string `json:"module"`
Repository string `json:"repository"`
Path string `json:"path"`
Commit string `json:"commit"`
FP string `json:"fp,omitempty"`
None string `json:"none,omitempty"`
}
// CatalogModule is one module whole: its entry and its manifest as the trunk holds it.
type CatalogModule struct {
CatalogEntry
Manifest json.RawMessage `json:"manifest"`
}
// CatalogEnd is a module that provides, requires or depends on something, with its commit; Scope is a provider's scope
// (a module provides its own name at node scope).
type CatalogEnd struct {
Module string `json:"module"`
Commit string `json:"commit"`
Scope string `json:"scope,omitempty"`
}
// CatalogModules is the answer of the verb modules: every module the trunk holds, sorted by name.
type CatalogModules struct {
Modules []CatalogEntry `json:"modules"`
}
// CatalogOne is the answer of the verb module.
type CatalogOne struct {
Module CatalogModule `json:"module"`
}
// CatalogProvides is the answer of the verb provides: the modules that provide the provision and those that require it.
type CatalogProvides struct {
Provision string `json:"provision"`
Provides []CatalogEnd `json:"provides"`
Requires []CatalogEnd `json:"requires"`
}
// CatalogDependents is the answer of the verb dependents: the modules whose build edges reach the module.
type CatalogDependents struct {
Module string `json:"module"`
Dependents []CatalogEnd `json:"dependents"`
}