You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
686 B
26 lines
686 B
package weed_server
|
|
|
|
import (
|
|
"github.com/chrislusf/seaweedfs/weed/storage/needle"
|
|
"net/http"
|
|
)
|
|
|
|
type ClusterStatusResult struct {
|
|
IsLeader bool `json:"IsLeader,omitempty"`
|
|
Leader string `json:"Leader,omitempty"`
|
|
Peers []string `json:"Peers,omitempty"`
|
|
MaxVolumeId needle.VolumeId `json:"MaxVolumeId,omitempty"`
|
|
}
|
|
|
|
func (s *RaftServer) StatusHandler(w http.ResponseWriter, r *http.Request) {
|
|
ret := ClusterStatusResult{
|
|
IsLeader: s.topo.IsLeader(),
|
|
Peers: s.Peers(),
|
|
MaxVolumeId: s.topo.GetMaxVolumeId(),
|
|
}
|
|
|
|
if leader, e := s.topo.Leader(); e == nil {
|
|
ret.Leader = leader
|
|
}
|
|
writeJsonQuiet(w, r, http.StatusOK, ret)
|
|
}
|