summaryrefslogtreecommitdiff
path: root/plugins/resetter
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-09-16 17:12:37 +0300
committerValery Piashchynski <[email protected]>2021-09-16 17:12:37 +0300
commitf3491c089b4da77fd8d2bc942a88b6b8d117a8a5 (patch)
tree32bfffb1f24eeee7b909747cc00a6a6b9fd3ee83 /plugins/resetter
parent5d2cd55ab522d4f1e65a833f91146444465a32ac (diff)
Move plugins to a separate repository
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/resetter')
-rw-r--r--plugins/resetter/interface.go7
-rw-r--r--plugins/resetter/plugin.go55
-rw-r--r--plugins/resetter/rpc.go29
3 files changed, 0 insertions, 91 deletions
diff --git a/plugins/resetter/interface.go b/plugins/resetter/interface.go
deleted file mode 100644
index 0defcaba..00000000
--- a/plugins/resetter/interface.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package resetter
-
-// Resetter interface
-type Resetter interface {
- // Reset reload plugin
- Reset() error
-}
diff --git a/plugins/resetter/plugin.go b/plugins/resetter/plugin.go
deleted file mode 100644
index 191185ae..00000000
--- a/plugins/resetter/plugin.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package resetter
-
-import (
- endure "github.com/spiral/endure/pkg/container"
- "github.com/spiral/errors"
-)
-
-const PluginName = "resetter"
-
-type Plugin struct {
- registry map[string]Resetter
-}
-
-func (p *Plugin) Init() error {
- p.registry = make(map[string]Resetter)
- return nil
-}
-
-// Reset named service.
-func (p *Plugin) Reset(name string) error {
- const op = errors.Op("resetter_plugin_reset_by_name")
- svc, ok := p.registry[name]
- if !ok {
- return errors.E(op, errors.Errorf("no such plugin: %s", name))
- }
-
- return svc.Reset()
-}
-
-// RegisterTarget resettable service.
-func (p *Plugin) RegisterTarget(name endure.Named, r Resetter) error {
- p.registry[name.Name()] = r
- return nil
-}
-
-// Collects declares services to be collected.
-func (p *Plugin) Collects() []interface{} {
- return []interface{}{
- p.RegisterTarget,
- }
-}
-
-// Name of the service.
-func (p *Plugin) Name() string {
- return PluginName
-}
-
-// Available interface implementation
-func (p *Plugin) Available() {
-}
-
-// RPC returns associated rpc service.
-func (p *Plugin) RPC() interface{} {
- return &rpc{srv: p}
-}
diff --git a/plugins/resetter/rpc.go b/plugins/resetter/rpc.go
deleted file mode 100644
index 79171b5c..00000000
--- a/plugins/resetter/rpc.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package resetter
-
-import "github.com/spiral/errors"
-
-type rpc struct {
- srv *Plugin
-}
-
-// List all resettable plugins.
-func (rpc *rpc) List(_ bool, list *[]string) error {
- *list = make([]string, 0)
-
- for name := range rpc.srv.registry {
- *list = append(*list, name)
- }
- return nil
-}
-
-// Reset named plugin.
-func (rpc *rpc) Reset(service string, done *bool) error {
- const op = errors.Op("resetter_rpc_reset")
- err := rpc.srv.Reset(service)
- if err != nil {
- *done = false
- return errors.E(op, err)
- }
- *done = true
- return nil
-}