Browse Source

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.
Brandon Philips 12 years ago
parent
commit
e79f6842bb
1 changed files with 4 additions and 6 deletions
  1. 4 6
      command.go

+ 4 - 6
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