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

Add MessagePack archiver #128

Open
rggjan opened this issue Oct 7, 2014 · 13 comments
Open

Add MessagePack archiver #128

rggjan opened this issue Oct 7, 2014 · 13 comments

Comments

@rggjan
Copy link

rggjan commented Oct 7, 2014

A MessagePack (http://msgpack.org/) archiver would be great. This would have the advantage of being as cross-platform as the json archiver, however with much smaller memory requirements...

@AzothAmmo
Copy link
Contributor

Any archives included within cereal need to be header only including all dependencies so that we can bundle all of them.

We won't implement support for MessagePack ourselves but would accept a well written archive into cereal. Here are a few C++ implementaions for anyone interested: https://github.com/msgpack/msgpack-c and https://github.com/Lichtso/netLink.

@rggjan
Copy link
Author

rggjan commented Oct 9, 2014

Sounds good. Yes, I know the two implementations. However, they are both not header only. I see two options:

  1. Just add the archiver header to cereal and require the user to have message pack already installed
  2. also add one of the two message pack libraries to cereal, and make them header only by converting all functions to inline functions.

What do you think?

@AzothAmmo
Copy link
Contributor

Option 1 is not a valid option for inclusion in cereal - you are free to develop and release this standalone, but anything included in cereal itself must be entirely self contained.

Option 2 is feasible depending upon the license of the libraries and how large they are - ideally we want anything related to an archive to be as small as possible. A message pack archiver would likely be folded into some kind of a module for cereal, see #123, unless the implementation was concise.

@rggjan
Copy link
Author

rggjan commented Nov 11, 2014

Comment: This would be option 2. The library is (in the newest version on github) header only and not that big. Also the license is Apache LicenseVersion 2.0, which should be fine I guess?

@AzothAmmo
Copy link
Contributor

I discussed this with @randvoorhies and we will very likely end up merging the code but it will become a cereal module, which is something we're going to roll out for 1.2. We'll be making repositories for the various modules at https://github.com/cerealcpp while keeping the main cereal repository in the same place it is now.

In regards to your code, the biggest impact this will have is that we are going to restructure unit tests a little - right now the unit tests are monolithic source files - we'll split up the actual test into a header file (e.g. the test_array() function) which can be included and instantiated as necessary (e.g. BOOST_TEST_CASE( xxx )). This way you don't need to modify the tests that ship with cereal and your module will ship with its own test suite. Or potentially we could have some kind of a system where the build system would know about your custom archive and add it to the tests.

We'll have to figure out the best way to market the modules, I'm guessing for now we'll hand curate them and list them on the website.

@AzothAmmo AzothAmmo added this to the v1.2.0 milestone Nov 11, 2014
@ecorm
Copy link

ecorm commented May 19, 2015

Sounds good. Yes, I know the two implementations. However, they are both not header only.

@rggjan, msgpack-c is indeed header-only if you use the C++ API

@rggjan
Copy link
Author

rggjan commented May 20, 2015

@ecorm, yes I know, that's great! At the time of writing this was not the case yet, but msgpack-c added header only support to the newest version.

@Type1J
Copy link

Type1J commented Jul 14, 2015

Any progress here?

@AzothAmmo
Copy link
Contributor

The pull request is at #138, we haven't made any progress in merging it yet.

@Type1J
Copy link

Type1J commented Jul 14, 2015

Having a cross language binary format (any of them) is very desirable for me. I'm going to try to work from the pull request fork until it's merged.

@AzothAmmo AzothAmmo modified the milestones: v1.2.0, v1.3.0 Sep 28, 2015
@kklouzal
Copy link
Contributor

kklouzal commented Aug 13, 2016

How does this perform, memory wise, compared to the included Binary and Portable Binary archives? Does MessagePack output smaller archives?

@stephanlachnit
Copy link

How about https://github.com/mikeloomisgg/cppack? It is a single header so much simpler than msgpack-c. The interface is also quite similar to cereal so maybe it would be easy to do. One disadvantage is that the last commit was from 2019.

@Type1J
Copy link

Type1J commented Jan 28, 2023

@stephanlachnit When it works, it works, so that may be a good option for some people. I've been using Rust with serde, lately, and I've translated most of the C and C++ that I modify frequently to Rust, so it worked out well. The backends for serde give a variety of formats, and it doesn't require any more than an annotation at the top of a struct to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants