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))
| 47 | // be unique to avoid overwriting modules. If initFn is nil, the module will not initialise. |
| 48 | // Modules are user visible by default. |
| 49 | func (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 |
no outgoing calls