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 {
|
func (c *SetCommand) GeneratePath() string {
|
||||||
return "/set/" + c.Key
|
return "set/" + c.Key
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *SetCommand) Type() string {
|
func (c *SetCommand) Type() string {
|
||||||
|
@ -77,7 +77,7 @@ func (c *GetCommand) Apply(server *raft.Server) ([]byte, error){
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GetCommand) GeneratePath() string{
|
func (c *GetCommand) GeneratePath() string{
|
||||||
return "/get/" + c.Key
|
return "get/" + c.Key
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GetCommand) Type() string{
|
func (c *GetCommand) Type() string{
|
||||||
|
@ -113,7 +113,7 @@ func (c *DeleteCommand) Apply(server *raft.Server) ([]byte, error){
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeleteCommand) GeneratePath() string{
|
func (c *DeleteCommand) GeneratePath() string{
|
||||||
return "/delete/" + c.Key
|
return "delete/" + c.Key
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DeleteCommand) Type() string{
|
func (c *DeleteCommand) Type() string{
|
||||||
|
@ -154,7 +154,7 @@ func (c *WatchCommand) Apply(server *raft.Server) ([]byte, error){
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *WatchCommand) GeneratePath() string{
|
func (c *WatchCommand) GeneratePath() string{
|
||||||
return "/watch/" + c.Key
|
return "watch/" + c.Key
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *WatchCommand) Type() string{
|
func (c *WatchCommand) Type() string{
|
||||||
|
|
3
raftd.go
3
raftd.go
|
@ -6,7 +6,6 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/benbjohnson/go-raft"
|
"github.com/benbjohnson/go-raft"
|
||||||
//"github.com/gorilla/mux"
|
|
||||||
"log"
|
"log"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -112,8 +111,8 @@ func main() {
|
||||||
server.SetElectionTimeout(10 * time.Second)
|
server.SetElectionTimeout(10 * time.Second)
|
||||||
server.SetHeartbeatTimeout(1 * time.Second)
|
server.SetHeartbeatTimeout(1 * time.Second)
|
||||||
server.StartLeader()
|
server.StartLeader()
|
||||||
// join self
|
|
||||||
|
|
||||||
|
// join self
|
||||||
command := &JoinCommand{}
|
command := &JoinCommand{}
|
||||||
command.Name = server.Name()
|
command.Name = server.Name()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue