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