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

Helper for reading & writing from binary #1600

Merged
merged 8 commits into from
Jun 22, 2016
Merged

Conversation

jml
Copy link
Contributor

@jml jml commented Jun 17, 2016

I found a couple of places where we had said in code that reports are serialized as compress msgpacks. This patch formalizes that convention by providing an API.

I'm working on another PR where I re-use this API in a different place.

There are a bunch of places in tests that could probably also be changed.


This change is Reviewable

@tomwilkie
Copy link
Contributor

Should we factor out https://github.com/weaveworks/scope/blob/master/app/router.go#L121 as well? Would need to support JSON.

Otherwise LGTM.

@jml
Copy link
Contributor Author

jml commented Jun 20, 2016

I did the refactoring. Basically I make ReadBinary take more options and leave MakeFromBinary being the default gzipped msgpack. I'm not so fond of the names any more, but I think it's an incremental improvement.

@tomwilkie tomwilkie self-assigned this Jun 20, 2016
return nil
}

// ReadBinary reads into a Report from a gzipped msgpack.

This comment was marked as abuse.

@jml
Copy link
Contributor Author

jml commented Jun 21, 2016

PTAL.

if codecHandle != nil {
decoder = codec.NewDecoder(r, codecHandle).Decode
} else {
decoder = gob.NewDecoder(r).Decode

This comment was marked as abuse.

@jml
Copy link
Contributor Author

jml commented Jun 22, 2016

@tomwilkie @rade PTAL.

@tomwilkie
Copy link
Contributor

LGTM but the build is failing for a reason that seems related...

@jml
Copy link
Contributor Author

jml commented Jun 22, 2016

The test was for gob support, which this branch removes.

@jml jml merged commit 37f482c into master Jun 22, 2016
@jml jml deleted the extract-report-serialzn branch June 22, 2016 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants