From e79f6842bbb1378de67e8fe165a88fa427f8099f Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Sun, 18 Aug 2013 21:46:17 -0700 Subject: [PATCH] fix(command): change Version to RaftVersion clear up confusion on what this field is used for: it is for the internal raft protocol version only. --- command.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/command.go b/command.go index b4ee1646c..e2fa002eb 100644 --- a/command.go +++ b/command.go @@ -117,7 +117,7 @@ func (c *WatchCommand) Apply(server *raft.Server) (interface{}, error) { // JoinCommand type JoinCommand struct { - Version string `json:"version"` + RaftVersion string `json:"raftVersion"` Name string `json:"name"` RaftURL string `json:"raftURL"` EtcdURL string `json:"etcdURL"` @@ -125,9 +125,7 @@ type JoinCommand struct { func newJoinCommand() *JoinCommand { return &JoinCommand{ - // TODO: This will be the internal protocol version but tie it - // to the release tag for now. - Version: r.version, + RaftVersion: r.version, Name: r.name, RaftURL: r.url, EtcdURL: e.url, @@ -156,14 +154,14 @@ func (c *JoinCommand) Apply(raftServer *raft.Server) (interface{}, error) { return []byte("join fail"), etcdErr.NewError(103, "") } - addNameToURL(c.Name, c.Version, c.RaftURL, c.EtcdURL) + addNameToURL(c.Name, c.RaftVersion, c.RaftURL, c.EtcdURL) // add peer in raft err := raftServer.AddPeer(c.Name, "") // add machine in etcd storage key := path.Join("_etcd/machines", c.Name) - value := fmt.Sprintf("raft=%s&etcd=%s&version=%s", c.RaftURL, c.EtcdURL, c.Version) + 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()) return []byte("join success"), err