mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
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.
This commit is contained in:
parent
2c9e90d6ad
commit
e79f6842bb
10
command.go
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user