Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigInterface ¶
type ConfigInterface interface {
IsActive() bool
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) FindModule ¶
FindModule instance by module name
func (*Manager) ShutdownModules ¶
ShutdownModules means close the rover instance dynamically
type Module ¶
type Module interface {
// Name of module.
// It would be use when declaring this module into configuration or other module need to reference.
Name() string
// RequiredModules means which modules do this module is depended on,
// The current module started after the dependent modules are Start success.
RequiredModules() []string
// Config of this module
// The config is automatically read from the configuration file before module Start
Config() ConfigInterface
// Start module
// The module needs to return the start result after startup is completed
Start(ctx context.Context, mgr *Manager) error
// NotifyStartSuccess when all module have been start success
NotifyStartSuccess()
// Shutdown module, the sequence of shutdown is the reverse of the module Start
// The shutdown would trigger in the following cases
// 1. If other modules fail to start
// 2. The module is actively shutdown through Manager.ShutdownModules
// 3. The Rover receive the close SIGNAL
Shutdown(ctx context.Context, mgr *Manager) error
}
Module define
func FindModule ¶
Click to show internal directories.
Click to hide internal directories.