registry

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Module contracts.Module
	Info   contracts.ModuleInfo
	State  contracts.ModuleState
	Health error
	Deps   []string
}

Entry holds a registered module and its metadata.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry is the core module registry. It stores modules indexed by ID, maintains a capability index for fast lookup, and provides the contracts.Registry interface for module discovery.

func New

func New() *Registry

New creates an empty Registry.

func (*Registry) Count

func (r *Registry) Count() int

func (*Registry) DependencyGraph added in v0.4.0

func (r *Registry) DependencyGraph(id string) ([]string, error)

DependencyGraph returns all module IDs that list the given module in their DependsOn. Useful for understanding the impact of stopping or removing a module.

func (*Registry) Discover

func (r *Registry) Discover(ctx context.Context, role string) []contracts.ModuleInfo

func (*Registry) FindByCapability

func (r *Registry) FindByCapability(cap string) []contracts.ModuleEntry

func (*Registry) FindByRole added in v0.4.0

func (r *Registry) FindByRole(role string) []contracts.ModuleEntry

func (*Registry) Get

func (r *Registry) Get(id string) (*Entry, error)

func (*Registry) List

func (r *Registry) List() []*Entry

func (*Registry) ListAll

func (r *Registry) ListAll() []contracts.ModuleEntry

func (*Registry) ListByCapability

func (r *Registry) ListByCapability(cap string) []*Entry

func (*Registry) ListByRole added in v0.4.0

func (r *Registry) ListByRole(role string) []*Entry

func (*Registry) Register

func (r *Registry) Register(module contracts.Module, deps []string) error

Register adds a module to the registry. Returns an error if the module ID is empty, the module name is empty, or the ID is already registered. Core performs no interface validation — that responsibility belongs to consumer modules, contract repos, and the marketplace compatibility checker.

func (*Registry) Resolve

func (r *Registry) Resolve(id string) (contracts.ModuleEntry, error)

func (*Registry) ResolveDeps

func (r *Registry) ResolveDeps(id string) ([]string, error)

func (*Registry) SetHealth

func (r *Registry) SetHealth(id string, err error) error

func (*Registry) SetState

func (r *Registry) SetState(id string, state contracts.ModuleState) error

func (*Registry) StartupOrder added in v0.4.0

func (r *Registry) StartupOrder() ([]string, error)

StartupOrder returns all module IDs in dependency-respecting order. Modules in DependsOn appear before the module that depends on them. Returns an error if a dependency cycle is detected.

func (*Registry) SupportsCapability

func (r *Registry) SupportsCapability(moduleID, cap string) bool

func (*Registry) Unregister

func (r *Registry) Unregister(id string) error

Unregister removes a module and cleans up its capability index entries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL