Move REST* interfaces into pkg/api/rest

Dependency chain is now api -> api/rest -> apiserver.  Makes the
interfaces much cleaner to read, and cleans up some inconsistenties
that crept in along the way.
This commit is contained in:
Clayton Coleman
2015-03-21 12:24:16 -04:00
parent df672504c2
commit d46087db50
30 changed files with 216 additions and 187 deletions

View File

@@ -135,7 +135,7 @@ func (rs *REST) List(ctx api.Context, label labels.Selector, field fields.Select
}
// Watch returns Events events via a watch.Interface.
// It implements apiserver.ResourceWatcher.
// It implements rest.Watcher.
func (rs *REST) Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
return rs.registry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, rs.getAttrs}, resourceVersion)
}

View File

@@ -21,8 +21,8 @@ import (
"testing"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/rest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/testapi"
"github.com/GoogleCloudPlatform/kubernetes/pkg/apiserver"
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/registry/registrytest"
@@ -74,8 +74,8 @@ func TestRESTCreate(t *testing.T) {
}
for _, item := range table {
_, rest := NewTestREST()
c, err := rest.Create(item.ctx, item.event)
_, storage := NewTestREST()
c, err := storage.Create(item.ctx, item.event)
if !item.valid {
if err == nil {
ctxNS := api.NamespaceValue(item.ctx)
@@ -94,7 +94,7 @@ func TestRESTCreate(t *testing.T) {
t.Errorf("diff: %s", util.ObjectDiff(e, a))
}
// Ensure we implement the interface
_ = apiserver.ResourceWatcher(rest)
_ = rest.Watcher(storage)
}
}