MCPcopy Index your code
hub / github.com/cortexproject/cortex / InitModuleServices

Method InitModuleServices

pkg/util/modules/modules.go:74–85  ·  view source on GitHub ↗

InitModuleServices initialises given modules by initialising all their dependencies in the right order. Modules are wrapped in such a way that they start after their dependencies have been started and stop before their dependencies are stopped.

(modules ...string)

Source from the content-addressed store, hash-verified

72// in the right order. Modules are wrapped in such a way that they start after their
73// dependencies have been started and stop before their dependencies are stopped.
74func (m *Manager) InitModuleServices(modules ...string) (map[string]services.Service, error) {
75 servicesMap := map[string]services.Service{}
76 initMap := map[string]bool{}
77
78 for _, module := range modules {
79 if err := m.initModule(module, initMap, servicesMap); err != nil {
80 return nil, err
81 }
82 }
83
84 return servicesMap, nil
85}
86
87func (m *Manager) initModule(name string, initMap map[string]bool, servicesMap map[string]services.Service) error {
88 if _, ok := m.modules[name]; !ok {

Callers 4

TestDependenciesFunction · 0.95
TestCortexFunction · 0.80
RunMethod · 0.80

Calls 1

initModuleMethod · 0.95

Tested by 3

TestDependenciesFunction · 0.76
TestCortexFunction · 0.64