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)
| 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. |
| 74 | func (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 | |
| 87 | func (m *Manager) initModule(name string, initMap map[string]bool, servicesMap map[string]services.Service) error { |
| 88 | if _, ok := m.modules[name]; !ok { |