diff options
Diffstat (limited to 'plugins/informer/rpc.go')
-rw-r--r-- | plugins/informer/rpc.go | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/plugins/informer/rpc.go b/plugins/informer/rpc.go deleted file mode 100644 index 478d3227..00000000 --- a/plugins/informer/rpc.go +++ /dev/null @@ -1,59 +0,0 @@ -package informer - -import ( - "github.com/spiral/roadrunner/v2/pkg/state/job" - "github.com/spiral/roadrunner/v2/pkg/state/process" -) - -type rpc struct { - srv *Plugin -} - -// WorkerList contains list of workers. -type WorkerList struct { - // Workers are list of workers. - Workers []*process.State `json:"workers"` -} - -// List all resettable services. -func (rpc *rpc) List(_ bool, list *[]string) error { - *list = make([]string, 0, len(rpc.srv.withWorkers)) - - // append all plugin names to the output result - for name := range rpc.srv.available { - *list = append(*list, name) - } - return nil -} - -// Workers state of a given service. -func (rpc *rpc) Workers(service string, list *WorkerList) error { - workers := rpc.srv.Workers(service) - if workers == nil { - return nil - } - - // write actual processes - list.Workers = workers - - return nil -} - -func (rpc *rpc) Jobs(service string, out *[]*job.State) error { - *out = rpc.srv.Jobs(service) - return nil -} - -// sort.Sort - -func (w *WorkerList) Len() int { - return len(w.Workers) -} - -func (w *WorkerList) Less(i, j int) bool { - return w.Workers[i].Pid < w.Workers[j].Pid -} - -func (w *WorkerList) Swap(i, j int) { - w.Workers[i], w.Workers[j] = w.Workers[j], w.Workers[i] -} |