MCPcopy Create free account
hub / github.com/foxcpp/maddy / Register

Method Register

framework/container/registry.go:60–76  ·  view source on GitHub ↗

Register adds not-initialized (configured) module into registry. lazyInit function will be called on first request to get the module from registry.

(mod module.Module, lazyInit func() error)

Source from the content-addressed store, hash-verified

58// lazyInit function will be called on first request to get the module from
59// registry.
60func (r *Registry) Register(mod module.Module, lazyInit func() error) error {
61 instName := mod.InstanceName()
62 if instName == "" {
63 panic("module with empty instance name cannot be added to the registry")
64 }
65
66 _, ok := r.instances[instName]
67 if ok {
68 return ErrInstanceNameDuplicate
69 }
70
71 r.instances[instName] = registryEntry{
72 Mod: mod,
73 LazyInit: lazyInit,
74 }
75 return nil
76}
77
78func (r *Registry) AddAlias(instanceName string, alias string) error {
79 if instanceName == "" {

Callers 1

RegisterModulesFunction · 0.80

Calls 1

InstanceNameMethod · 0.65

Tested by

no test coverage detected