summaryrefslogtreecommitdiff
path: root/plugins/resetter/rpc.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-11-18 11:24:20 +0300
committerValery Piashchynski <[email protected]>2020-11-18 11:24:20 +0300
commit2b395a5f1bd431a2a9c80c35a2ca5f42066c9ffd (patch)
tree1542b018ee2aa8511f5e8a8b64b2f45c52e91048 /plugins/resetter/rpc.go
parenta2ba8de5eb519f73044a9b1c66f087a5b65e3d45 (diff)
parent0a48a027642a34c560717526c55f70b7260d678c (diff)
Merge branch 'release_2.0' into plugin/http
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)
+}