Decouple apiserver from codec implementation

The apiserver on initialization must be provided with a codec
for encoding and decoding all handled objects including api.Status
and api.ServerOp.  In addition, the RESTStorage Extract() method
has been changed to New(), which returns a pointer object that the
codec must decode into (the internal object).  Switched registry
methods to use pointers for Create/Update instead of values.
This commit is contained in:
Clayton Coleman
2014-08-05 23:10:48 -04:00
parent 4123a44653
commit c9fc0bcf3d
16 changed files with 140 additions and 128 deletions

View File

@@ -42,7 +42,7 @@ func TestWatchWebsocket(t *testing.T) {
simpleStorage := &SimpleRESTStorage{}
handler := New(map[string]RESTStorage{
"foo": simpleStorage,
}, "/prefix/version")
}, codec, "/prefix/version")
server := httptest.NewServer(handler)
dest, _ := url.Parse(server.URL)
@@ -92,7 +92,7 @@ func TestWatchHTTP(t *testing.T) {
simpleStorage := &SimpleRESTStorage{}
handler := New(map[string]RESTStorage{
"foo": simpleStorage,
}, "/prefix/version")
}, codec, "/prefix/version")
server := httptest.NewServer(handler)
client := http.Client{}