Documentation ¶
Overview ¶
Package modmanager provides the module manager for a robot.
Index ¶
- func DepsToNames(deps resource.Dependencies) []string
- func NewManager(ctx context.Context, parentAddr string, logger logging.Logger, ...) modmaninterface.ModuleManager
- type Manager
- func (mgr *Manager) Add(ctx context.Context, confs ...config.Module) error
- func (mgr *Manager) AddResource(ctx context.Context, conf resource.Config, deps []string) (resource.Resource, error)
- func (mgr *Manager) CleanModuleDataDirectory() error
- func (mgr *Manager) Close(ctx context.Context) error
- func (mgr *Manager) Configs() []config.Module
- func (mgr *Manager) FirstRun(ctx context.Context, conf config.Module) error
- func (mgr *Manager) Handles() map[string]modlib.HandlerMap
- func (mgr *Manager) IsModularResource(name resource.Name) bool
- func (mgr *Manager) Provides(conf resource.Config) bool
- func (mgr *Manager) Reconfigure(ctx context.Context, conf config.Module) ([]resource.Name, error)
- func (mgr *Manager) ReconfigureResource(ctx context.Context, conf resource.Config, deps []string) error
- func (mgr *Manager) Remove(modName string) ([]resource.Name, error)
- func (mgr *Manager) RemoveResource(ctx context.Context, name resource.Name) error
- func (mgr *Manager) ResolveImplicitDependenciesInConfig(ctx context.Context, conf *config.Diff) error
- func (mgr *Manager) ValidateConfig(ctx context.Context, conf resource.Config) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DepsToNames ¶
func DepsToNames(deps resource.Dependencies) []string
DepsToNames converts a dependency list to a simple string slice.
func NewManager ¶
func NewManager( ctx context.Context, parentAddr string, logger logging.Logger, options modmanageroptions.Options, ) modmaninterface.ModuleManager
NewManager returns a Manager.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the root structure for the module system.
func (*Manager) Add ¶
Add adds and starts a new resource modules for each given module configuration.
Each module configuration should have a unique name - if duplicate names are detected, then only the first duplicate instance will be processed and the rest will be ignored.
func (*Manager) AddResource ¶
func (mgr *Manager) AddResource(ctx context.Context, conf resource.Config, deps []string) (resource.Resource, error)
AddResource tells a component module to configure a new component.
func (*Manager) CleanModuleDataDirectory ¶ added in v0.13.0
CleanModuleDataDirectory removes unexpected folders and files from the robot's module data directory. Modules removed from the robot config (even temporarily) will get pruned here.
func (*Manager) Configs ¶ added in v0.2.50
Configs returns a slice of config.Module representing the currently managed modules.
func (*Manager) Handles ¶ added in v0.12.0
func (mgr *Manager) Handles() map[string]modlib.HandlerMap
Handles returns all the models for each module registered.
func (*Manager) IsModularResource ¶
IsModularResource returns true if an existing resource IS handled by a module.
func (*Manager) Provides ¶
Provides returns true if a component/service config WOULD be handled by a module.
func (*Manager) Reconfigure ¶ added in v0.2.34
Reconfigure reconfigures an existing resource module and returns the names of now orphaned resources.
func (*Manager) ReconfigureResource ¶
func (mgr *Manager) ReconfigureResource(ctx context.Context, conf resource.Config, deps []string) error
ReconfigureResource updates/reconfigures a modular component with a new configuration.
func (*Manager) Remove ¶ added in v0.2.34
Remove removes and stops an existing resource module and returns the names of now orphaned resources.
func (*Manager) RemoveResource ¶
RemoveResource requests the removal of a resource from a module.
func (*Manager) ResolveImplicitDependenciesInConfig ¶ added in v0.12.0
func (mgr *Manager) ResolveImplicitDependenciesInConfig(ctx context.Context, conf *config.Diff) error
ResolveImplicitDependenciesInConfig mutates the passed in diff to add modular implicit dependencies to added and modified resources. It also puts modular resources whose module has been modified or added in conf.Added if they are not already there since the resources themselves are not necessarily new.