Merge pull request #2290 from pmorie/rename

Rename client/cache Store.Contains to ContainedIDs
This commit is contained in:
Daniel Smith 2014-11-11 10:16:19 -08:00
commit 97cb1fa2df
6 changed files with 11 additions and 11 deletions

View File

@ -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{}

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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{}

View File

@ -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")
}

View File

@ -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),