Begin to unify ResourceVersioner and SelfLinker

Create a new MetadataAccessor interface that combines both
and use it where previously latest.ResourceVersioner and SelfLinker
were being used.

Adds Namespace to the get/set interface. Adds TODO about future
fast path for metadata (as per thockin's comment)
This commit is contained in:
Clayton Coleman
2014-10-26 23:01:17 -04:00
parent 52b582271b
commit 66ace4c270
9 changed files with 303 additions and 38 deletions

View File

@@ -22,6 +22,7 @@ import (
"os"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta"
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
)
@@ -44,14 +45,14 @@ func Codec() runtime.Codec {
return interfaces.Codec
}
// ResourceVersioner returns the ResourceVersioner for the API version to test against,
// MetadataAccessor returns the MetadataAccessor for the API version to test against,
// as set by the KUBE_API_VERSION env var.
func ResourceVersioner() runtime.ResourceVersioner {
func MetadataAccessor() meta.MetadataAccessor {
interfaces, err := latest.InterfacesFor(Version())
if err != nil {
panic(err)
}
return interfaces.ResourceVersioner
return interfaces.MetadataAccessor
}
// SelfLink returns a self link that will appear to be for the version Version().