diff --git a/pkg/client/cache/fifo.go b/pkg/client/cache/fifo.go index 59d6e7b70b8..9803810270b 100644 --- a/pkg/client/cache/fifo.go +++ b/pkg/client/cache/fifo.go @@ -72,10 +72,10 @@ func (f *FIFO) List() []interface{} { return list } -// Contains returns a util.StringSet containing all IDs of stored the items. +// ContainedIDs returns a util.StringSet containing all IDs of stored the items. // This is a snapshot of a moment in time, and one should keep in mind that // other go routines can add or remove items after you call this. -func (c *FIFO) Contains() util.StringSet { +func (c *FIFO) ContainedIDs() util.StringSet { c.lock.RLock() defer c.lock.RUnlock() set := util.StringSet{} diff --git a/pkg/client/cache/poller.go b/pkg/client/cache/poller.go index d2c379b7868..70fec9361da 100644 --- a/pkg/client/cache/poller.go +++ b/pkg/client/cache/poller.go @@ -68,7 +68,7 @@ func (p *Poller) Run() { } func (p *Poller) sync(e Enumerator) { - current := p.store.Contains() + current := p.store.ContainedIDs() for i := 0; i < e.Len(); i++ { id, object := e.Get(i) p.store.Update(id, object) diff --git a/pkg/client/cache/poller_test.go b/pkg/client/cache/poller_test.go index 5ebfc21f260..92a75f2f620 100644 --- a/pkg/client/cache/poller_test.go +++ b/pkg/client/cache/poller_test.go @@ -70,7 +70,7 @@ func TestPoller_sync(t *testing.T) { for line, pairs := range item.steps { p.sync(testEnumerator(pairs)) - ids := s.Contains() + ids := s.ContainedIDs() for _, pair := range pairs { if !ids.Has(pair.id) { t.Errorf("%v, %v: expected to find entry for %v, but did not.", testCase, line, pair.id) @@ -113,7 +113,7 @@ func TestPoller_Run(t *testing.T) { <-done // We never added anything, verify that. - if e, a := 0, len(s.Contains()); e != a { + if e, a := 0, len(s.ContainedIDs()); e != a { t.Errorf("expected %v, got %v", e, a) } } diff --git a/pkg/client/cache/store.go b/pkg/client/cache/store.go index ebf0a2ce953..2c9fea4c2c7 100644 --- a/pkg/client/cache/store.go +++ b/pkg/client/cache/store.go @@ -31,7 +31,7 @@ type Store interface { Update(id string, obj interface{}) Delete(id string) List() []interface{} - Contains() util.StringSet + ContainedIDs() util.StringSet Get(id string) (item interface{}, exists bool) // Replace will delete the contents of the store, using instead the @@ -78,10 +78,10 @@ func (c *cache) List() []interface{} { return list } -// Contains returns a util.StringSet containing all IDs of stored the items. +// ContainedIDs returns a util.StringSet containing all IDs of stored the items. // This is a snapshot of a moment in time, and one should keep in mind that // other go routines can add or remove items after you call this. -func (c *cache) Contains() util.StringSet { +func (c *cache) ContainedIDs() util.StringSet { c.lock.RLock() defer c.lock.RUnlock() set := util.StringSet{} diff --git a/pkg/client/cache/store_test.go b/pkg/client/cache/store_test.go index 7e9af6eef91..f758333b657 100644 --- a/pkg/client/cache/store_test.go +++ b/pkg/client/cache/store_test.go @@ -62,7 +62,7 @@ func doTestStore(t *testing.T, store Store) { } // Check that ID list is correct. - ids := store.Contains() + ids := store.ContainedIDs() if !ids.HasAll("a", "c", "e") { t.Errorf("missing items") } @@ -90,7 +90,7 @@ func doTestStore(t *testing.T, store Store) { } // Check that ID list is correct. - ids := store.Contains() + ids := store.ContainedIDs() if !ids.HasAll("foo", "bar") { t.Errorf("missing items") } diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index a243ed410ff..122636939ee 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -95,7 +95,7 @@ func (factory *ConfigFactory) Create() *scheduler.Config { glog.V(2).Infof("About to try and schedule pod %v\n"+ "\tknown minions: %v\n"+ "\tknown scheduled pods: %v\n", - pod.Name, minionCache.Contains(), podCache.Contains()) + pod.Name, minionCache.ContainedIDs(), podCache.ContainedIDs()) return pod }, Error: factory.makeDefaultErrorFunc(&podBackoff, podQueue),