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

7 years ago
  1. package weed_server
  2. import (
  3. "github.com/chrislusf/seaweedfs/weed/operation"
  4. "net/http"
  5. )
  6. func (s *RaftServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request)) {
  7. s.router.HandleFunc(pattern, handler)
  8. }
  9. func (s *RaftServer) statusHandler(w http.ResponseWriter, r *http.Request) {
  10. ret := operation.ClusterStatusResult{
  11. IsLeader: s.topo.IsLeader(),
  12. Peers: s.Peers(),
  13. }
  14. if leader, e := s.topo.Leader(); e == nil {
  15. ret.Leader = leader
  16. }
  17. writeJsonQuiet(w, r, http.StatusOK, ret)
  18. }