mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-03 10:37:35 +01:00
add back "/cluster/status"
fix https://github.com/chrislusf/seaweedfs/issues/870
This commit is contained in:
1 parent
e71e0db5b7
commit
4773497d2c
3 files changed
+24
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ClusterStatusResult struct {
|
||||
IsLeader bool `json:"IsLeader,omitempty"`
|
||||
Leader string `json:"Leader,omitempty"`
|
||||
Peers []string `json:"Peers,omitempty"`
|
||||
}
|
||||
|
||||
func (s *RaftServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ret := ClusterStatusResult{
|
||||
IsLeader: s.topo.IsLeader(),
|
||||
Peers: s.Peers(),
|
||||
}
|
||||
if leader, e := s.topo.Leader(); e == nil {
|
||||
ret.Leader = leader
|
||||
}
|
||||
writeJsonQuiet(w, r, http.StatusOK, ret)
|
||||
}
|
||||
Reference in new issue
Block a user