diff options
author | Valery Piashchynski <[email protected]> | 2021-04-30 11:44:07 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-04-30 11:44:07 +0300 |
commit | 50aa751dcefc0ab0e96594a5f111ead316a34a70 (patch) | |
tree | 5cf1fd278e01e1bd23a3f39d408ceb49741c448c /plugins/informer/plugin.go | |
parent | 65015a3d3f4b387675b5ca005b8831a6be9e15aa (diff) |
- Update Lister implementation
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/informer/plugin.go')
-rw-r--r-- | plugins/informer/plugin.go | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/plugins/informer/plugin.go b/plugins/informer/plugin.go index 3d219cda..73e49575 100644 --- a/plugins/informer/plugin.go +++ b/plugins/informer/plugin.go @@ -4,20 +4,18 @@ import ( endure "github.com/spiral/endure/pkg/container" "github.com/spiral/errors" "github.com/spiral/roadrunner/v2/pkg/process" - "github.com/spiral/roadrunner/v2/plugins/logger" ) const PluginName = "informer" type Plugin struct { - registry map[string]Informer - plugins map[string]Lister - log logger.Logger + registry map[string]Informer + available map[string]Availabler } -func (p *Plugin) Init(log logger.Logger) error { +func (p *Plugin) Init() error { + p.available = make(map[string]Availabler) p.registry = make(map[string]Informer) - p.log = log return nil } @@ -36,18 +34,18 @@ func (p *Plugin) Workers(name string) ([]process.State, error) { func (p *Plugin) Collects() []interface{} { return []interface{}{ p.CollectWorkers, + p.CollectPlugins, } } // CollectPlugins collects all RR plugins -func (p *Plugin) CollectPlugins(name endure.Named, l Lister) { - p.plugins[name.Name()] = l +func (p *Plugin) CollectPlugins(name endure.Named, l Availabler) { + p.available[name.Name()] = l } // CollectWorkers obtains plugins with workers inside. -func (p *Plugin) CollectWorkers(name endure.Named, r Informer) error { +func (p *Plugin) CollectWorkers(name endure.Named, r Informer) { p.registry[name.Name()] = r - return nil } // Name of the service. @@ -57,5 +55,5 @@ func (p *Plugin) Name() string { // RPC returns associated rpc service. func (p *Plugin) RPC() interface{} { - return &rpc{srv: p, log: p.log} + return &rpc{srv: p} } |