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.
21 lines
523 B
21 lines
523 B
package weed_server
|
|
|
|
import (
|
|
"github.com/chrislusf/seaweedfs/weed/operation"
|
|
"net/http"
|
|
)
|
|
|
|
func (s *RaftServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
|
|
s.router.HandleFunc(pattern, handler)
|
|
}
|
|
|
|
func (s *RaftServer) statusHandler(w http.ResponseWriter, r *http.Request) {
|
|
ret := operation.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)
|
|
}
|