summaryrefslogtreecommitdiff
path: root/plugins/resetter/rpc.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-18 11:18:48 +0300
committerGitHub <[email protected]>2020-11-18 11:18:48 +0300
commit0a48a027642a34c560717526c55f70b7260d678c (patch)
tree6a6d173a85b31b436ce323044cfc066b50d8ba37 /plugins/resetter/rpc.go
parent5b70ac6fb2ed68cfb28174ff7a58b4ad4a63e0c1 (diff)
parenta136253bc88c1591cbab962af0506ff4c4cefc4b (diff)
Merge pull request #409 from spiral/plugin/resetterv2.0.0-alpha20
Plugin/resetter
Diffstat (limited to 'plugins/resetter/rpc.go')
-rw-r--r--plugins/resetter/rpc.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/resetter/rpc.go b/plugins/resetter/rpc.go
new file mode 100644
index 00000000..157aa8c6
--- /dev/null
+++ b/plugins/resetter/rpc.go
@@ -0,0 +1,30 @@
+package resetter
+
+import "github.com/spiral/roadrunner/v2/interfaces/log"
+
+type rpc struct {
+ srv *Plugin
+ log log.Logger
+}
+
+// List all resettable services.
+func (rpc *rpc) List(_ bool, list *[]string) error {
+ rpc.log.Info("started List method")
+ *list = make([]string, 0)
+
+ for name := range rpc.srv.registry {
+ *list = append(*list, name)
+ }
+ rpc.log.Debug("services list", "services", *list)
+
+ rpc.log.Info("finished List method")
+ return nil
+}
+
+// Reset named service.
+func (rpc *rpc) Reset(service string, done *bool) error {
+ rpc.log.Info("started Reset method for the service", "service", service)
+ defer rpc.log.Info("finished Reset method for the service", "service", service)
+ *done = true
+ return rpc.srv.Reset(service)
+}