Simple refactor for ease of readability

runtime.DefaultCodec -> latest.Codec
This commit is contained in:
Clayton Coleman
2014-09-16 15:56:26 -04:00
parent 10f68902f6
commit fe614aeda2
21 changed files with 69 additions and 69 deletions

View File

@@ -135,7 +135,7 @@ func (s ConfigSourceEtcd) GetServices() ([]api.Service, []api.Endpoints, error)
// and create a Service entry for it.
for i, node := range response.Node.Nodes {
var svc api.Service
err = runtime.DefaultCodec.DecodeInto([]byte(node.Value), &svc)
err = latest.Codec.DecodeInto([]byte(node.Value), &svc)
if err != nil {
glog.Errorf("Failed to load Service: %s (%#v)", node.Value, err)
continue
@@ -168,7 +168,7 @@ func (s ConfigSourceEtcd) GetEndpoints(service string) (api.Endpoints, error) {
}
// Parse all the endpoint specifications in this value.
var e api.Endpoints
err = runtime.DefaultCodec.DecodeInto([]byte(response.Node.Value), &e)
err = latest.Codec.DecodeInto([]byte(response.Node.Value), &e)
return e, err
}
@@ -178,7 +178,7 @@ func etcdResponseToService(response *etcd.Response) (*api.Service, error) {
return nil, fmt.Errorf("invalid response from etcd: %#v", response)
}
var svc api.Service
err := runtime.DefaultCodec.DecodeInto([]byte(response.Node.Value), &svc)
err := latest.Codec.DecodeInto([]byte(response.Node.Value), &svc)
if err != nil {
return nil, err
}
@@ -232,7 +232,7 @@ func (s ConfigSourceEtcd) ProcessChange(response *etcd.Response) {
func (s ConfigSourceEtcd) ProcessEndpointResponse(response *etcd.Response) {
glog.Infof("Processing a change in endpoint configuration... %s", *response)
var endpoints api.Endpoints
err := runtime.DefaultCodec.DecodeInto([]byte(response.Node.Value), &endpoints)
err := latest.Codec.DecodeInto([]byte(response.Node.Value), &endpoints)
if err != nil {
glog.Errorf("Failed to parse service out of etcd key: %v : %+v", response.Node.Value, err)
return