MCPcopy
hub / github.com/grafana/dskit / InitModuleServices

Method InitModuleServices

modules/modules.go:103–114  ·  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

101// in the right order. Modules are wrapped in such a way that they start after their
102// dependencies have been started and stop before their dependencies are stopped.
103func (m *Manager) InitModuleServices(modules ...string) (map[string]services.Service, error) {
104 servicesMap := map[string]services.Service{}
105 initMap := map[string]bool{}
106
107 for _, module := range modules {
108 if err := m.initModule(module, initMap, servicesMap); err != nil {
109 return nil, err
110 }
111 }
112
113 return servicesMap, nil
114}
115
116func (m *Manager) initModule(name string, initMap map[string]bool, servicesMap map[string]services.Service) error {
117 if _, ok := m.modules[name]; !ok {

Callers 2

TestDependenciesFunction · 0.95

Calls 1

initModuleMethod · 0.95

Tested by 2

TestDependenciesFunction · 0.76