remove unused file

This commit is contained in:
Chris Lu 2019-02-19 14:16:19 -08:00
parent 58d4088db4
commit 72c2e6bb8f

View file

@ -1,32 +0,0 @@
package operation
import (
"encoding/json"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
)
type ClusterStatusResult struct {
IsLeader bool `json:"IsLeader,omitempty"`
Leader string `json:"Leader,omitempty"`
Peers []string `json:"Peers,omitempty"`
}
func ListMasters(server string) (leader string, peers []string, err error) {
jsonBlob, err := util.Get("http://" + server + "/cluster/status")
glog.V(2).Info("list masters result :", string(jsonBlob))
if err != nil {
return "", nil, err
}
var ret ClusterStatusResult
err = json.Unmarshal(jsonBlob, &ret)
if err != nil {
return "", nil, err
}
peers = ret.Peers
if ret.IsLeader {
peers = append(peers, ret.Leader)
}
return ret.Leader, peers, nil
}