Changes in codec interfaces

This commit is contained in:
Wojciech Tyczynski
2015-10-30 14:19:07 +01:00
parent 1831a057f1
commit ce95f68d2a
2 changed files with 58 additions and 54 deletions

View File

@@ -43,6 +43,13 @@ type ObjectRetriever interface {
Add(runtime.Object) error
}
// ObjectScheme abstracts the implementation of common operations on objects.
type ObjectScheme interface {
runtime.ObjectCreater
runtime.ObjectCopier
runtime.ObjectTyper
}
// ObjectReaction returns a ReactionFunc that takes a generic action string of the form
// <verb>-<resource> or <verb>-<subresource>-<resource> and attempts to return a runtime
// Object or error that matches the requested action. For instance, list-replicationControllers
@@ -119,7 +126,7 @@ func AddObjectsFromPath(path string, o ObjectRetriever, decoder runtime.Decoder)
type objects struct {
types map[string][]runtime.Object
last map[string]int
scheme runtime.ObjectScheme
scheme ObjectScheme
decoder runtime.ObjectDecoder
}
@@ -135,7 +142,7 @@ var _ ObjectRetriever = &objects{}
// as a runtime.Object if Status == Success). If multiple PodLists are provided, they
// will be returned in order by the Kind call, and the last PodList will be reused for
// subsequent calls.
func NewObjects(scheme runtime.ObjectScheme, decoder runtime.ObjectDecoder) ObjectRetriever {
func NewObjects(scheme ObjectScheme, decoder runtime.ObjectDecoder) ObjectRetriever {
return objects{
types: make(map[string][]runtime.Object),
last: make(map[string]int),