all config -> cfg

This commit is contained in:
Blake Mizerany
2014-08-13 17:04:29 -07:00
committed by Yicheng Qin
parent a5eec89113
commit 0881021e54
11 changed files with 63 additions and 63 deletions

View File

@@ -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.

View File

@@ -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)

View File

@@ -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)
}