Skip to content

Engine: Module Registry #9

@ollieread

Description

@ollieread

The module registry is an immutable, read-only view of all discovered modules. It is populated by loading the cache file generated during discovery and is available throughout the engine lifecycle after bootstrapping.

Loading

The registry is initialised by reading the generated cache file. It does not perform any discovery or reflection itself — that is entirely the responsibility of the discovery process. If no cache file exists, the registry cannot be initialised and the engine should error clearly.

ModuleRegistry

ModuleRegistry is an immutable class exposing the following:

  • All manifests as a map of ident -> ModuleManifest
  • All enabled module idents as a list
  • All disabled module idents as a list
  • All registrars for enabled modules as a map of ident -> ModuleRegistrar
  • Lookup of a single ModuleManifest by ident
  • Lookup of a single ModuleRegistrar by ident
  • Check whether a given ident is enabled
  • Check whether a given ident is disabled
  • Check whether a given ident is present at all

Registrar Lifecycle

The registry holds registrar metadata (ModuleRegistrar) alongside manifests. There is a case for clearing registrar metadata from the registry after the lifecycle phases are complete, since the metadata is only needed during register, boot, and collect. This is left as a future consideration — for now registrars remain in the registry for the full request lifetime.

Tasks

  • Implement ModuleRegistry with manifest and registrar maps and all lookup methods
  • Implement cache file loader that populates the registry from the generated cache
  • Error clearly when no cache file is present
  • Write tests for all registry lookup methods
  • Write tests for enabled and disabled ident checks
  • Write tests for missing cache file error handling

Metadata

Metadata

Assignees

Labels

layer: engineBase framework and engine work

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions