Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor some uses of snapshotter.Add() to use bool rather than real object #458

Merged
merged 1 commit into from
Aug 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pkg/backends/backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (b *Backends) Create(sp utils.ServicePort, hcLink string) (*composite.Backe
if err := composite.CreateBackendService(be, b.cloud); err != nil {
return nil, err
}
b.snapshotter.Add(name, be)
b.snapshotter.Add(name, true)
// Note: We need to perform a GCE call to re-fetch the object we just created
// so that the "Fingerprint" field is filled in. This is needed to update the
// object without error.
Expand All @@ -113,7 +113,7 @@ func (b *Backends) Update(be *composite.BackendService) error {
if err := composite.UpdateBackendService(be, b.cloud); err != nil {
return err
}
b.snapshotter.Add(be.Name, be)
b.snapshotter.Add(be.Name, true)
return nil
}

Expand All @@ -133,7 +133,7 @@ func (b *Backends) Get(name string, version meta.Version) (*composite.BackendSer
return nil, err
}
}
b.snapshotter.Add(name, be)
b.snapshotter.Add(name, true)
return be, nil
}

Expand Down Expand Up @@ -193,8 +193,8 @@ func (b *Backends) List() ([]interface{}, error) {
return nil, err
}
var ret []interface{}
for _, x := range backends {
ret = append(ret, x)
for _, _ = range backends {
ret = append(ret, true)
}
return ret, nil
}
4 changes: 2 additions & 2 deletions pkg/instances/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (i *Instances) EnsureInstanceGroupsAndPorts(name string, ports []int64) (ig
return nil, err
}

defer i.snapshotter.Add(name, struct{}{})
defer i.snapshotter.Add(name, true)
for _, zone := range zones {
ig, err := i.ensureInstanceGroupAndPorts(name, zone, ports)
if err != nil {
Expand Down Expand Up @@ -200,7 +200,7 @@ func (i *Instances) Get(name, zone string) (*compute.InstanceGroup, error) {
if err != nil {
return nil, err
}
i.snapshotter.Add(name, struct{}{})
i.snapshotter.Add(name, true)
return ig, nil
}

Expand Down