Skip to content
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

Merged

Conversation

smarterclayton
Copy link
Contributor

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

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.
@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 10, 2015
@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e build/test failed for commit 1e21054.

@smarterclayton
Copy link
Contributor Author

ok to test

@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e build/test failed for commit 1e21054.

@smarterclayton
Copy link
Contributor Author

ok to test

@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e build/test failed for commit 1e21054.

@smarterclayton
Copy link
Contributor Author

ok to test

@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e build/test failed for commit 1e21054.

@caesarxuchao
Copy link
Member

@k8s-bot test this please

@k8s-bot
Copy link

k8s-bot commented Dec 10, 2015

GCE e2e test build/test passed for commit 1e21054.

@caesarxuchao
Copy link
Member

Sorry for the delay. I'll make a pass this week.

@smarterclayton
Copy link
Contributor Author

ok to unit test

@smarterclayton
Copy link
Contributor Author

@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)
Copy link
Member

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()?

Copy link
Contributor Author

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.

@caesarxuchao
Copy link
Member

@k8s-bot unit test this

@caesarxuchao
Copy link
Member

LGTM. Thanks.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 14, 2015
@k8s-github-robot
Copy link

@k8s-bot test this

Tests are more than 48 hours old. Re-running tests.

@k8s-bot
Copy link

k8s-bot commented Dec 14, 2015

GCE e2e test build/test passed for commit 1e21054.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Dec 14, 2015

GCE e2e test build/test passed for commit 1e21054.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Dec 14, 2015
@k8s-github-robot k8s-github-robot merged commit 266ab4a into kubernetes:master Dec 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants