From 7cc2a1fe389ed49d7842d6b544f49e3022a196fe Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Tue, 26 Apr 2016 17:33:04 +0100 Subject: [PATCH] refactor: more descriptive function name --- ipam/allocator.go | 6 +++--- prog/weaver/main.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ipam/allocator.go b/ipam/allocator.go index 9f3bf219..478c6545 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -320,13 +320,13 @@ func (alloc *Allocator) ContainerStarted(ident string) { } } -func (alloc *Allocator) AllContainerIDs(ids []string) { +func (alloc *Allocator) PruneOwned(ids []string) { alloc.actionChan <- func() { idmap := make(map[string]struct{}, len(ids)) for _, id := range ids { idmap[id] = struct{}{} } - alloc.syncOwned(idmap) + alloc.pruneOwned(idmap) } } @@ -1004,7 +1004,7 @@ func (alloc *Allocator) findOwner(addr address.Address) string { } // For each ID in the 'owned' map, remove the entry if it isn't in the map -func (alloc *Allocator) syncOwned(ids map[string]struct{}) { +func (alloc *Allocator) pruneOwned(ids map[string]struct{}) { changed := false for ident, d := range alloc.owned { if !d.IsContainer { diff --git a/prog/weaver/main.go b/prog/weaver/main.go index 836a7bb3..73c4369d 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -304,7 +304,7 @@ func main() { observeContainers(allocator) ids, err := dockerCli.AllContainerIDs() checkFatal(err) - allocator.AllContainerIDs(ids) + allocator.PruneOwned(ids) } var (