diff options
Diffstat (limited to 'plugins/informer/rpc.go')
-rw-r--r-- | plugins/informer/rpc.go | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/plugins/informer/rpc.go b/plugins/informer/rpc.go index 3925ef64..02254865 100644 --- a/plugins/informer/rpc.go +++ b/plugins/informer/rpc.go @@ -11,7 +11,7 @@ type rpc struct { // WorkerList contains list of workers. type WorkerList struct { // Workers is list of workers. - Workers []process.State `json:"workers"` + Workers []*process.State `json:"workers"` } // List all resettable services. @@ -38,3 +38,17 @@ func (rpc *rpc) Workers(service string, list *WorkerList) error { 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] +} |