refactor: more descriptive function name

This commit is contained in:
Matthias Radestock committed 2016-04-26 17:33:04 +01:00
1 parent 8fdbaf5745
commit 7cc2a1fe38
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -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() { alloc.actionChan <- func() {
idmap := make(map[string]struct{}, len(ids)) idmap := make(map[string]struct{}, len(ids))
for _, id := range ids { for _, id := range ids {
idmap[id] = struct{}{} 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 // 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 changed := false
for ident, d := range alloc.owned { for ident, d := range alloc.owned {
if !d.IsContainer { if !d.IsContainer {
+1 -1
View File
@@ -304,7 +304,7 @@ func main() {
observeContainers(allocator) observeContainers(allocator)
ids, err := dockerCli.AllContainerIDs() ids, err := dockerCli.AllContainerIDs()
checkFatal(err) checkFatal(err)
allocator.AllContainerIDs(ids) allocator.PruneOwned(ids)
} }
var ( var (