summaryrefslogtreecommitdiff
path: root/plugins/resetter/rpc.go
blob: 79171b5c1343ea269036645ae90c54b5bbb8aca0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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
}