Pass resource version to storage List operation.

This commit is contained in:
Wojciech Tyczynski
2015-10-26 14:56:51 +01:00
parent a094a6e3de
commit aa30e38183
32 changed files with 82 additions and 69 deletions

View File

@@ -61,8 +61,9 @@ type Lister interface {
// NewList returns an empty object that can be used with the List call.
// This object must be a pointer type for use with Codec.DecodeInto([]byte, runtime.Object)
NewList() runtime.Object
// List selects resources in the storage which match to the selector.
List(ctx api.Context, label labels.Selector, field fields.Selector) (runtime.Object, error)
// List selects resources in the storage which match to the selector. 'options' can be nil.
// TODO: Move 'label' and 'field' to 'options'.
List(ctx api.Context, label labels.Selector, field fields.Selector, options *api.ListOptions) (runtime.Object, error)
}
// Getter is an object that can retrieve a named RESTful resource.
@@ -183,6 +184,7 @@ type Watcher interface {
// are supported; an error should be returned if 'field' tries to select on a field that
// isn't supported. 'resourceVersion' allows for continuing/starting a watch at a
// particular version.
// TODO: Replace 'label', 'field' and 'resourceVersion' with ListOptions.
Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error)
}

View File

@@ -853,7 +853,7 @@ func (t *Tester) testListError() {
storageError := fmt.Errorf("test error")
t.withStorageError(storageError, func() {
_, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything())
_, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything(), nil)
if err != storageError {
t.Errorf("unexpected error: %v", err)
}
@@ -870,7 +870,7 @@ func (t *Tester) testListFound(obj runtime.Object, assignFn AssignFunc) {
existing := assignFn([]runtime.Object{foo1, foo2})
listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything())
listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything(), nil)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -902,7 +902,7 @@ func (t *Tester) testListMatchLabels(obj runtime.Object, assignFn AssignFunc) {
filtered := []runtime.Object{existing[1]}
selector := labels.SelectorFromSet(labels.Set(testLabels))
listObj, err := t.storage.(rest.Lister).List(ctx, selector, fields.Everything())
listObj, err := t.storage.(rest.Lister).List(ctx, selector, fields.Everything(), nil)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
@@ -924,7 +924,7 @@ func (t *Tester) testListNotFound(assignFn AssignFunc, setRVFn SetRVFunc) {
setRVFn(uint64(123))
_ = assignFn([]runtime.Object{})
listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything())
listObj, err := t.storage.(rest.Lister).List(ctx, labels.Everything(), fields.Everything(), nil)
if err != nil {
t.Errorf("unexpected error: %v", err)
}