mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
all config -> cfg
This commit is contained in:
committed by
Yicheng Qin
parent
a5eec89113
commit
0881021e54
@@ -85,11 +85,11 @@ func (c *Client) GetClusterConfig(url string) (*ClusterConfig, *etcdErr.Error) {
|
||||
return nil, clientError(err)
|
||||
}
|
||||
|
||||
config := new(ClusterConfig)
|
||||
if uerr := c.parseJSONResponse(resp, config); uerr != nil {
|
||||
cfg := new(ClusterConfig)
|
||||
if uerr := c.parseJSONResponse(resp, cfg); uerr != nil {
|
||||
return nil, uerr
|
||||
}
|
||||
return config, nil
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// AddMachine adds machine to the cluster.
|
||||
|
||||
@@ -204,19 +204,19 @@ func (ps *PeerServer) setClusterConfigHttpHandler(w http.ResponseWriter, req *ht
|
||||
}
|
||||
|
||||
// Copy config and update fields passed in.
|
||||
config := ps.ClusterConfig()
|
||||
cfg := ps.ClusterConfig()
|
||||
if activeSize, ok := m["activeSize"].(float64); ok {
|
||||
config.ActiveSize = int(activeSize)
|
||||
cfg.ActiveSize = int(activeSize)
|
||||
}
|
||||
if removeDelay, ok := m["removeDelay"].(float64); ok {
|
||||
config.RemoveDelay = removeDelay
|
||||
cfg.RemoveDelay = removeDelay
|
||||
}
|
||||
if syncInterval, ok := m["syncInterval"].(float64); ok {
|
||||
config.SyncInterval = syncInterval
|
||||
cfg.SyncInterval = syncInterval
|
||||
}
|
||||
|
||||
// Issue command to update.
|
||||
c := &SetClusterConfigCommand{Config: config}
|
||||
c := &SetClusterConfigCommand{Config: cfg}
|
||||
log.Debugf("[recv] Update Cluster Config Request")
|
||||
ps.server.Dispatch(c, w, req)
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ type StandbyServer struct {
|
||||
sync.Mutex
|
||||
}
|
||||
|
||||
func NewStandbyServer(config StandbyServerConfig, client *Client) *StandbyServer {
|
||||
func NewStandbyServer(cfg StandbyServerConfig, client *Client) *StandbyServer {
|
||||
s := &StandbyServer{
|
||||
Config: config,
|
||||
Config: cfg,
|
||||
client: client,
|
||||
standbyInfo: standbyInfo{SyncInterval: DefaultSyncInterval},
|
||||
}
|
||||
@@ -229,14 +229,14 @@ func (s *StandbyServer) syncCluster(peerURLs []string) error {
|
||||
continue
|
||||
}
|
||||
|
||||
config, err := s.client.GetClusterConfig(peerURL)
|
||||
cfg, err := s.client.GetClusterConfig(peerURL)
|
||||
if err != nil {
|
||||
log.Debugf("fail getting cluster config from %v", peerURL)
|
||||
continue
|
||||
}
|
||||
|
||||
s.setCluster(machines)
|
||||
s.SetSyncInterval(config.SyncInterval)
|
||||
s.SetSyncInterval(cfg.SyncInterval)
|
||||
if err := s.saveInfo(); err != nil {
|
||||
log.Warnf("fail saving cluster info into disk: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user