MCPcopy Create free account
hub / github.com/cortexproject/cortex / RegisterModule

Method RegisterModule

pkg/util/modules/modules.go:49–58  ·  view source on GitHub ↗

RegisterModule registers a new module with name, init function, and options. Name must be unique to avoid overwriting modules. If initFn is nil, the module will not initialise. Modules are user visible by default.

(name string, initFn func() (services.Service, error), options ...func(option *module))

Source from the content-addressed store, hash-verified

47// be unique to avoid overwriting modules. If initFn is nil, the module will not initialise.
48// Modules are user visible by default.
49func (m *Manager) RegisterModule(name string, initFn func() (services.Service, error), options ...func(option *module)) {
50 m.modules[name] = &module{
51 initFn: initFn,
52 userVisible: true,
53 }
54
55 for _, o := range options {
56 o(m.modules[name])
57 }
58}
59
60// AddDependency adds a dependency from name(source) to dependsOn(targets)
61// An error is returned if the source module name is not found

Calls

no outgoing calls