Browse Source

fix generate path (generate to slash)

Xiang Li 12 years ago
parent
commit
acb66f3428
2 changed files with 5 additions and 6 deletions
  1. 4 4
      command.go
  2. 1 2
      raftd.go

+ 4 - 4
command.go

@@ -40,7 +40,7 @@ func (c *SetCommand) Apply(server *raft.Server) ([]byte, error) {
 }
 
 func (c *SetCommand) GeneratePath() string {
-	return "/set/" + c.Key
+	return "set/" + c.Key
 }
 
 func (c *SetCommand) Type() string {
@@ -77,7 +77,7 @@ func (c *GetCommand) Apply(server *raft.Server) ([]byte, error){
 }
 
 func (c *GetCommand) GeneratePath() string{
-	return "/get/" + c.Key
+	return "get/" + c.Key
 }
 
 func (c *GetCommand) Type() string{
@@ -113,7 +113,7 @@ func (c *DeleteCommand) Apply(server *raft.Server) ([]byte, error){
 }
 
 func (c *DeleteCommand) GeneratePath() string{
-	return "/delete/" + c.Key
+	return "delete/" + c.Key
 }
 
 func (c *DeleteCommand) Type() string{
@@ -154,7 +154,7 @@ func (c *WatchCommand) Apply(server *raft.Server) ([]byte, error){
 }
 
 func (c *WatchCommand) GeneratePath() string{
-	return "/watch/" + c.Key
+	return "watch/" + c.Key
 }
 
 func (c *WatchCommand) Type() string{

+ 1 - 2
raftd.go

@@ -6,7 +6,6 @@ import (
 	"flag"
 	"fmt"
 	"github.com/benbjohnson/go-raft"
-	//"github.com/gorilla/mux"
 	"log"
 	"io"
 	"io/ioutil"
@@ -112,8 +111,8 @@ func main() {
 			server.SetElectionTimeout(10 * time.Second)
 			server.SetHeartbeatTimeout(1 * time.Second)
 			server.StartLeader()
-			// join self 
 
+			// join self 
 			command := &JoinCommand{}
 			command.Name = server.Name()