Browse Source

etcd: move raftprefix to raft_handler

Xiang Li 11 years ago
parent
commit
2f51735e8a
2 changed files with 6 additions and 4 deletions
  1. 0 2
      etcd/etcd.go
  2. 6 2
      etcd/raft_handler.go

+ 0 - 2
etcd/etcd.go

@@ -11,8 +11,6 @@ import (
 )
 
 const (
-	raftPrefix = "/raft"
-
 	participantMode int64 = iota
 	standbyMode
 	stopMode

+ 6 - 2
etcd/raft_handler.go

@@ -10,6 +10,10 @@ import (
 	"github.com/coreos/etcd/raft"
 )
 
+const (
+	raftPrefix = "/raft"
+)
+
 type raftHandler struct {
 	mu      sync.RWMutex
 	serving bool
@@ -26,8 +30,8 @@ func newRaftHandler(p peerGetter) *raftHandler {
 		peerGetter: p,
 	}
 	h.ServeMux = http.NewServeMux()
-	h.ServeMux.HandleFunc("/raft/cfg/", h.serveCfg)
-	h.ServeMux.HandleFunc("/raft", h.serveRaft)
+	h.ServeMux.HandleFunc(raftPrefix+"/cfg/", h.serveCfg)
+	h.ServeMux.HandleFunc(raftPrefix, h.serveRaft)
 	return h
 }