From cd0201df065d0f675fe0d6c59c51437d85daae20 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sun, 15 Sep 2013 20:50:35 -0400 Subject: [PATCH] fix import --- command.go | 7 ++++--- util.go | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/command.go b/command.go index 0e4a58bc1..3c901893a 100644 --- a/command.go +++ b/command.go @@ -9,6 +9,7 @@ import ( "time" etcdErr "github.com/coreos/etcd/error" + "github.com/coreos/etcd/file_system" "github.com/coreos/go-raft" ) @@ -213,12 +214,12 @@ func (c *JoinCommand) CommandName() string { func (c *JoinCommand) Apply(raftServer *raft.Server) (interface{}, error) { // check if the join command is from a previous machine, who lost all its previous log. - response, _ := etcdStore.RawGet(path.Join("_etcd/machines", c.Name)) + e, _ := etcdFs.Get(path.Join("/_etcd/machines", c.Name), false, false, raftServer.CommitIndex(), raftServer.Term()) b := make([]byte, 8) binary.PutUvarint(b, raftServer.CommitIndex()) - if response != nil { + if e != nil { return b, nil } @@ -237,7 +238,7 @@ func (c *JoinCommand) Apply(raftServer *raft.Server) (interface{}, error) { // add machine in etcd storage key := path.Join("_etcd/machines", c.Name) value := fmt.Sprintf("raft=%s&etcd=%s&raftVersion=%s", c.RaftURL, c.EtcdURL, c.RaftVersion) - etcdStore.Set(key, value, time.Unix(0, 0), raftServer.CommitIndex()) + etcdFs.Create(key, value, fileSystem.Permanent, raftServer.CommitIndex(), raftServer.Term()) if c.Name != r.Name() { r.peersStats[c.Name] = &raftPeerStats{MinLatency: 1 << 63} diff --git a/util.go b/util.go index 5d64e1fac..80673d3b0 100644 --- a/util.go +++ b/util.go @@ -14,8 +14,10 @@ import ( "strconv" "time" + etcdErr "github.com/coreos/etcd/error" "github.com/coreos/etcd/file_system" "github.com/coreos/etcd/web" + "github.com/coreos/go-raft" ) //--------------------------------------