modules

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is a component that initialises modules of the application in the right order of dependencies.

func NewManager

func NewManager() *Manager

NewManager creates a new Manager

func (*Manager) AddDependency

func (m *Manager) AddDependency(name string, dependsOn ...string) error

AddDependency adds a dependency from name(source) to dependsOn(targets) An error is returned if the source module name is not found

func (*Manager) InitModuleServices

func (m *Manager) InitModuleServices(target string) (map[string]services.Service, error)

InitModuleServices initialises the target module by initialising all its 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.

func (*Manager) RegisterModule

func (m *Manager) RegisterModule(name string, initFn func() (services.Service, error))

RegisterModule registers a new module with name and init function name must be unique to avoid overwriting modules if initFn is nil, the module will not initialise

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL