Skip to content

Add msgpack serialization support#1850

Closed
dalen wants to merge 6 commits intopuppetlabs:masterfrom
dalen:msgpack
Closed

Add msgpack serialization support#1850
dalen wants to merge 6 commits intopuppetlabs:masterfrom
dalen:msgpack

Conversation

@dalen
Copy link
Contributor

@dalen dalen commented Aug 24, 2013

This set of patches adds msgpack serialization support if the required library is installed.

Apart from that they also strip out the internal fact _timestamp as that was a time object and couldn't be serialized. This is basically a bugfix but could be considered a backwards incompatible change.

They also move the confine handling out of provider to avoid a require loop as it was also used by formats.

@puppetcla
Copy link

CLA signed by all contributors.

@slippycheeze
Copy link
Contributor

I think this is an excellent choice of encoding, and much saner than JSON for a transport layer intended to carry arbitrary binary data rather than just UTF-8 textual data. I can't comment on the code, but the theory is great.

@zaphod42
Copy link
Contributor

Should this also update the docs that we've started putting together for the rest endpoints were we state the supported formats?

@adrienthebo
Copy link
Contributor

@dalen there are a bunch of commits from Patrick here; did you pair with him during the developer day on this?

@dalen
Copy link
Contributor Author

dalen commented Aug 30, 2013

Yes, we paired, and I then rebased and squashed a bunch of commits together, so most of them are pair programmed really.

@adrienthebo
Copy link
Contributor

Okay, cool. Most of the time when I see two contributors on a single PR it usually means there was a bad rebase, so I wanted to get this sorted out before I dove in.

One big thing that jumps out at me is that this is backwards incompatible, since we're removing the Puppet::Provider::Confine constant. If we stubbed the old constant old like so:

Puppet::Provider::Confine = Puppet::Confine

I think this would alleviate this problem. What do you think?

@dalen
Copy link
Contributor Author

dalen commented Aug 31, 2013

That sounds good.

We were under the impression that 4.0 was the next release though, so a small break might not be a blocker :)

@dalen
Copy link
Contributor Author

dalen commented Sep 5, 2013

@adrienthebo do you want me to add that stub of the old constant to this pull request?

@adrienthebo
Copy link
Contributor

Actually, does the new msgpack functionality depend on the Confine class? Does that have to be done here?

The thing that jumps out at me is that we're doing three things in this pull request - extracting Confine, generalizing to_data_hash method calls, and adding the msgpack functionality. Personally, this pull request is a bit on the large side and I would like to see this changeset chunked up. That way we can get smaller parts of the change in, rather than an all or nothing commit.

@dalen
Copy link
Contributor Author

dalen commented Sep 9, 2013

Without moving the confine we got into a require loop with format_support and provider. Partly because we include format_support in more places to get the to_msgpack method.

@adrienthebo
Copy link
Contributor

Oh. Ew. Fair point.

Well, what do you think of splitting up this pull request so we can review each change separately? Or would you prefer to keep this as-is?

@dalen
Copy link
Contributor Author

dalen commented Sep 9, 2013

well, they are kind of depending on each other. so I'm not sure how to do that with multiple pull requests in github actually without waiting for the first to be merged before opening the next pull request etc.

@adrienthebo
Copy link
Contributor

@dalen it looks like this needs a rebase; in addition could you address the concerns about the constant Puppet::Provider::Confine being removed, which would break API compatibility?

@adrienthebo
Copy link
Contributor

It looks like this pull request hasn't seen any activity in about three weeks. Is this something that you're still able to work on? We're happy to keep this pull request open if there's forward movement, and we'll leave it open for another week. If there isn't any activity by then we may have to close this pull request due to lack of activity.

Closing the pull request wouldn't mean we don't consider this change valuable. However we try to keep all open pull requests moving towards completion, and closing stale pull requests help us focus on more active pull requests.

If you have any questions or concerns, please don't hesitate to ping us in #puppet-dev on irc.freenode.net.

pcarlisle and others added 6 commits October 2, 2013 17:21
Split out the parts generating a hash of the object itself from adding
document_type metadata.

Also split out for all resources that generated the hash directly inside
the to_pson method.
Use a feature to check for existence of msgpack library and add the
serialization format if it is supported.
Add to_msgpack back to serializable objects. They all have the same
implementation. The issue is nested objects; if an object with no msgpack
implementation is contained in the "data hash" then msgpack will try to call
to_msgpack on it. The alternative is to make sure there are only nested
hashes, but this is not backwards compatible with the pson formats.

Also strips out the internal fact _timestamp from the node object as
that is of type Time and cannot be serialized.
Provide backwards compatibility for code including the old confine
location inside provider.
@dalen
Copy link
Contributor Author

dalen commented Oct 2, 2013

I've rebased this again now.

The API compatibility concerns were already addressed.

@zaphod42
Copy link
Contributor

zaphod42 commented Oct 2, 2013

@dalen @adrienthebo Thanks for working on this. I'm going to bring it up at the team's weekly planning today to run this through the home stretch. Thanks for all of your work on this!

@dalen
Copy link
Contributor Author

dalen commented Oct 7, 2013

@zaphod42 was any decision reached on this?

@zaphod42
Copy link
Contributor

zaphod42 commented Oct 7, 2013

@dalen We weren't able to get to it for this week. We are fully booked on other work. I'm going to bring it up again on this Wednesday (or cycles are Wednesday-Wednesday).

@zaphod42
Copy link
Contributor

@dalen I'm picking this up now. Thanks for hanging in there :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: o_data_hash = to_data_hash

@zaphod42
Copy link
Contributor

I've fixed up the one thing that I saw in a branch. Don't worry about dealing with it, @dalen :)

@zaphod42 zaphod42 closed this in d7e4a27 Oct 11, 2013
@jpartlow
Copy link
Contributor

Hi @dalen , I'm reviewing this code change and noticed that with msgpack installed the default format switches to msgpack (previously yaml defaulted). I'm assuming this is intentional based on the weight => 20 in the format handler?

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.

7 participants