fix generate path (generate to slash)
parent
71c0ffec3a
commit
acb66f3428
|
@ -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{
|
||||
|
|
3
raftd.go
3
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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue