Documentation
¶
Overview ¶
Package module is how an application mounts its topic managers and lookup services in the Go overlay engine.
It replaces the TypeScript host's Module/ModuleHost loader. Go has no runtime module loading worth using, so a module is compiled in: its package calls Register from init, the binary imports it, and OVERLAY_MODULES names which registered modules this host mounts. Each module is a thin adapter over its application's Go core: it holds no admission or lookup logic of its own that the core does not already hold.
The interfaces are upstream's (go-overlay-services pkg/core/engine) unchanged, so a manager written here runs on any host of that engine.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Host ¶
type Host struct {
// Topics are the topics this host carries (OVERLAY_TOPICS). A module may
// claim only topics in this list.
Topics []string
// Storage is the engine's storage, for lookup services that answer from
// it rather than from an index of their own.
Storage engine.Storage
// Registerer is the host's metrics registry; a module's families use its
// own prefix (bstore_, bbox_ ...), never overlay_go_.
Registerer prometheus.Registerer
Log *slog.Logger
}
Host is what a module is handed when it is built.
type Module ¶
type Module struct {
TopicManagers map[string]engine.TopicManager
LookupServices map[string]engine.LookupService
}
Module is what a factory returns: managers keyed by tm_* topic name and lookup services keyed by ls_* name.
type Mounted ¶
type Mounted struct {
TopicManagers map[string]engine.TopicManager
LookupServices map[string]engine.LookupService
// Owner says which module mounted each topic and lookup name.
Owner map[string]string
}
Mounted is the result of Mount: what the engine is built with.
func Mount ¶
Mount builds the named modules in order and merges them. It refuses rather than resolves every conflict, and it refuses a carried topic with no manager: a host must never admit a topic under a manager nobody chose.
- a name not registered;
- a topic outside h.Topics, or claimed by two modules;
- a lookup name claimed by two modules;
- a carried topic no module claims.