-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide common codec methods under helpers #18487
Hide common codec methods under helpers #18487
Conversation
The pending codec -> conversion split changes the signature of Encode and Decode to be more complicated. Create a stub helper with the exact semantics of today and do the simple mechanical refactor here to reduce the cost of that change.
Labelling this PR as size/L |
GCE e2e build/test failed for commit 1e21054. |
ok to test |
GCE e2e build/test failed for commit 1e21054. |
ok to test |
GCE e2e build/test failed for commit 1e21054. |
ok to test |
GCE e2e build/test failed for commit 1e21054. |
@k8s-bot test this please |
GCE e2e test build/test passed for commit 1e21054. |
Sorry for the delay. I'll make a pass this week. |
ok to unit test |
@k8s-bot unit test this |
// DecodeInto performs a Decode into the provided object. | ||
// TODO: these are transitional interfaces to reduce refactor cost as Codec is altered. | ||
func DecodeInto(d Decoder, data []byte, into Object) error { | ||
return d.DecodeInto(data, into) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the interface contain DecodeInto()?
Will DecodeIntoWithSpecifiedVersionKind be implemented using d.Decode()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the decode variants have been removed and replaced (in my pr) with
something slightly more flexible than DecodeIntoWithSpecificVersionKind.
There will be one decode and one encode method, taking options on decoding.
On Dec 11, 2015, at 7:34 PM, Chao Xu notifications@github.com wrote:
In pkg/runtime/codec.go
#18487 (comment):
+// Encode is a convenience wrapper for encoding to a []byte from an Encoder
+// TODO: these are transitional interfaces to reduce refactor cost as Codec is altered.
+func Encode(e Encoder, obj Object) ([]byte, error) {
- return e.Encode(obj)
+}
+
+// Decode is a convenience wrapper for decoding data into an Object.
+// TODO: these are transitional interfaces to reduce refactor cost as Codec is altered.
+func Decode(d Decoder, data []byte) (Object, error) {- return d.Decode(data)
+}
+
+// DecodeInto performs a Decode into the provided object.
+// TODO: these are transitional interfaces to reduce refactor cost as Codec is altered.
+func DecodeInto(d Decoder, data []byte, into Object) error {- return d.DecodeInto(data, into)
Will the interface contain DecodeInto()?
Will DecodeIntoWithSpecifiedVersionKind be implemented using d.Decode()?
—
Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/18487/files#r47421872.
@k8s-bot unit test this |
LGTM. Thanks. |
@k8s-bot test this Tests are more than 48 hours old. Re-running tests. |
GCE e2e test build/test passed for commit 1e21054. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 1e21054. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
The pending codec -> conversion split changes the signature of
Encode and Decode to be more complicated. Create a stub helper
with the exact semantics of today and do the simple mechanical
refactor here to reduce the cost of that change.
Extracted from #17922