mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
remove unused file
This commit is contained in:
parent
58d4088db4
commit
72c2e6bb8f
|
@ -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
|
|
||||||
}
|
|
Loading…
Reference in a new issue