fix the namespaceScoped of cachers

This commit is contained in:
Chao Xu
2016-01-21 16:59:30 -08:00
parent 2aff6ccf06
commit ebcff4b5e4
24 changed files with 44 additions and 26 deletions

View File

@@ -35,8 +35,10 @@ type REST struct {
func NewREST(s storage.Interface, storageDecorator generic.StorageDecorator) *REST {
prefix := "/testtype"
newListFunc := func() runtime.Object { return &testgroup.TestTypeList{} }
// Usually you should reuse your RESTCreateStrategy.
strategy := &NotNamespaceScoped{}
storageInterface := storageDecorator(
s, 100, &testgroup.TestType{}, prefix, false, newListFunc)
s, 100, &testgroup.TestType{}, prefix, strategy, newListFunc)
store := &etcdgeneric.Etcd{
NewFunc: func() runtime.Object { return &testgroup.TestType{} },
// NewListFunc returns an object capable of storing results of an etcd list.
@@ -63,3 +65,10 @@ func NewREST(s storage.Interface, storageDecorator generic.StorageDecorator) *RE
}
return &REST{store}
}
type NotNamespaceScoped struct {
}
func (*NotNamespaceScoped) NamespaceScoped() bool {
return false
}