Merge pull request #16273 from wojtek-t/list_options_in_api

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot
2015-10-29 01:57:29 -07:00
32 changed files with 82 additions and 69 deletions

View File

@@ -219,8 +219,8 @@ func (c *Cacher) GetToList(ctx context.Context, key string, filter FilterFunc, l
}
// Implements storage.Interface.
func (c *Cacher) List(ctx context.Context, key string, filter FilterFunc, listObj runtime.Object) error {
return c.storage.List(ctx, key, filter, listObj)
func (c *Cacher) List(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc, listObj runtime.Object) error {
return c.storage.List(ctx, key, resourceVersion, filter, listObj)
}
// ListFromMemory implements list operation (the same signature as List method)
@@ -344,7 +344,7 @@ func newCacherListerWatcher(storage Interface, resourcePrefix string, newListFun
// Implements cache.ListerWatcher interface.
func (lw *cacherListerWatcher) List() (runtime.Object, error) {
list := lw.newListFunc()
if err := lw.storage.List(context.TODO(), lw.resourcePrefix, Everything, list); err != nil {
if err := lw.storage.List(context.TODO(), lw.resourcePrefix, 0, Everything, list); err != nil {
return nil, err
}
return list, nil

View File

@@ -350,7 +350,7 @@ func (h *etcdHelper) decodeNodeList(nodes []*etcd.Node, filter storage.FilterFun
}
// Implements storage.Interface.
func (h *etcdHelper) List(ctx context.Context, key string, filter storage.FilterFunc, listObj runtime.Object) error {
func (h *etcdHelper) List(ctx context.Context, key string, resourceVersion uint64, filter storage.FilterFunc, listObj runtime.Object) error {
if ctx == nil {
glog.Errorf("Context is nil")
}

View File

@@ -135,7 +135,7 @@ func TestList(t *testing.T) {
var got api.PodList
// TODO: a sorted filter function could be applied such implied
// ordering on the returned list doesn't matter.
err := helper.List(context.TODO(), key, storage.Everything, &got)
err := helper.List(context.TODO(), key, 0, storage.Everything, &got)
if err != nil {
t.Errorf("Unexpected error %v", err)
}
@@ -174,7 +174,7 @@ func TestListFiltered(t *testing.T) {
}
var got api.PodList
err := helper.List(context.TODO(), key, filter, &got)
err := helper.List(context.TODO(), key, 0, filter, &got)
if err != nil {
t.Errorf("Unexpected error %v", err)
}
@@ -224,7 +224,7 @@ func TestListAcrossDirectories(t *testing.T) {
list.Items[2] = *returnedObj
var got api.PodList
err := roothelper.List(context.TODO(), rootkey, storage.Everything, &got)
err := roothelper.List(context.TODO(), rootkey, 0, storage.Everything, &got)
if err != nil {
t.Errorf("Unexpected error %v", err)
}

View File

@@ -116,7 +116,9 @@ type Interface interface {
// List unmarshalls jsons found at directory defined by key and opaque them
// into *List api object (an object that satisfies runtime.IsList definition).
List(ctx context.Context, key string, filter FilterFunc, listObj runtime.Object) error
// The returned contents may be delayed, but it is guaranteed that they will
// be have at least 'resourceVersion'.
List(ctx context.Context, key string, resourceVersion uint64, filter FilterFunc, listObj runtime.Object) error
// GuaranteedUpdate keeps calling 'tryUpdate()' to update key 'key' (of type 'ptrToType')
// retrying the update until success if there is index conflict.