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 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 // 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. // 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() c.lock.RLock()
defer c.lock.RUnlock() defer c.lock.RUnlock()
set := util.StringSet{} set := util.StringSet{}

View File

@ -68,7 +68,7 @@ func (p *Poller) Run() {
} }
func (p *Poller) sync(e Enumerator) { func (p *Poller) sync(e Enumerator) {
current := p.store.Contains() current := p.store.ContainedIDs()
for i := 0; i < e.Len(); i++ { for i := 0; i < e.Len(); i++ {
id, object := e.Get(i) id, object := e.Get(i)
p.store.Update(id, object) p.store.Update(id, object)

View File

@ -70,7 +70,7 @@ func TestPoller_sync(t *testing.T) {
for line, pairs := range item.steps { for line, pairs := range item.steps {
p.sync(testEnumerator(pairs)) p.sync(testEnumerator(pairs))
ids := s.Contains() ids := s.ContainedIDs()
for _, pair := range pairs { for _, pair := range pairs {
if !ids.Has(pair.id) { if !ids.Has(pair.id) {
t.Errorf("%v, %v: expected to find entry for %v, but did not.", testCase, line, 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 <-done
// We never added anything, verify that. // 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) t.Errorf("expected %v, got %v", e, a)
} }
} }

View File

@ -31,7 +31,7 @@ type Store interface {
Update(id string, obj interface{}) Update(id string, obj interface{})
Delete(id string) Delete(id string)
List() []interface{} List() []interface{}
Contains() util.StringSet ContainedIDs() util.StringSet
Get(id string) (item interface{}, exists bool) Get(id string) (item interface{}, exists bool)
// Replace will delete the contents of the store, using instead the // Replace will delete the contents of the store, using instead the
@ -78,10 +78,10 @@ func (c *cache) List() []interface{} {
return list 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 // 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. // 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() c.lock.RLock()
defer c.lock.RUnlock() defer c.lock.RUnlock()
set := util.StringSet{} set := util.StringSet{}

View File

@ -62,7 +62,7 @@ func doTestStore(t *testing.T, store Store) {
} }
// Check that ID list is correct. // Check that ID list is correct.
ids := store.Contains() ids := store.ContainedIDs()
if !ids.HasAll("a", "c", "e") { if !ids.HasAll("a", "c", "e") {
t.Errorf("missing items") t.Errorf("missing items")
} }
@ -90,7 +90,7 @@ func doTestStore(t *testing.T, store Store) {
} }
// Check that ID list is correct. // Check that ID list is correct.
ids := store.Contains() ids := store.ContainedIDs()
if !ids.HasAll("foo", "bar") { if !ids.HasAll("foo", "bar") {
t.Errorf("missing items") 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"+ glog.V(2).Infof("About to try and schedule pod %v\n"+
"\tknown minions: %v\n"+ "\tknown minions: %v\n"+
"\tknown scheduled pods: %v\n", "\tknown scheduled pods: %v\n",
pod.Name, minionCache.Contains(), podCache.Contains()) pod.Name, minionCache.ContainedIDs(), podCache.ContainedIDs())
return pod return pod
}, },
Error: factory.makeDefaultErrorFunc(&podBackoff, podQueue), Error: factory.makeDefaultErrorFunc(&podBackoff, podQueue),