msgpack

MessagePack: fast cross-platform serializer and RPC - please share experience

偶尔善良 提交于 2019-12-31 13:13:18
问题 Looking for some fast, simple and stable RPC library I stumbled upon MessagePack project which seems to be very good. It is also under active development. If you used it in any way, could you please share your experience? P.S. I think this question should be community wiki 回答1: Well, after some time I found that MessagePack is not well-documented (there was even non-working tutorial in Wiki for Java), there are like 7 outstanding bugs several months old without any replies. Code even is not

MessagePack: fast cross-platform serializer and RPC - please share experience

纵然是瞬间 提交于 2019-12-31 13:13:12
问题 Looking for some fast, simple and stable RPC library I stumbled upon MessagePack project which seems to be very good. It is also under active development. If you used it in any way, could you please share your experience? P.S. I think this question should be community wiki 回答1: Well, after some time I found that MessagePack is not well-documented (there was even non-working tutorial in Wiki for Java), there are like 7 outstanding bugs several months old without any replies. Code even is not

How to convert a tabular format or python dataframe-equivalent format to msgpack format in C++

感情迁移 提交于 2019-12-24 19:27:09
问题 (Please Note: I am not able to embed images here. I dont have enough points for that. Could anyone please help me with that.) I understand how to convert the struct corresponding to the following tablular format (Struct1) into msgpack format: Struct1 For this I use the following code: #include <sstream> #include <iostream> #include <msgpack.hpp> inline std::ostream& hex_dump(std::ostream& o, std::string const& v) { std::ios::fmtflags f(o.flags()); o << std::hex; o << "b\'"; for (auto c : v) {

Get pointer to and length of element in msgpack array from C/C++

核能气质少年 提交于 2019-12-13 02:32:46
问题 I have some data that was packed with msgpack using the C/C++ api as follows: msgpack::sbuffer sbuf; msgpack::packer<msgpack::sbuffer> pk(&sbuf); int var1 = 10; std::string var2 = "test"; double var3 = 3.14159; // could be any type pk.pack_array(3); pk.pack(var1); pk.pack(var2); pk.pack(var3); At a later point I need to unpack that array, but need direct access to the third element so I can persist to file/db/redis/memcached/etc. While the first two elements of the array are fixed types, the

how to pack multi-key map with msgpack-c

强颜欢笑 提交于 2019-12-12 00:20:11
问题 I am trying to use msgpack (in c version, not c++) to replace our own serialization method, which is in primary xml based. It is quite straight forward to pack some ordinary data. However, we have a lot of k-v based structures like struct Table { struct Key { // Multi-keys int key1; int key2; }; struct Attr { // Attributes int attr1; bool attr2; char[8] attr3; }; } How to pack multi-key table with msg_pack_map in msgpack-c? (unfortunately, our system is exception disabled, so I cannot use the

How to derive instances of Data.Messagepack 1.0.0

ε祈祈猫儿з 提交于 2019-12-11 11:32:24
问题 The previous version of Data.Messagepack , 0.7.2.5 supports deriving instances via Template Haskell. The current version (1.0.0), however, doesn't. I was hence wondering if there is an alternative way to automatically derive MessagePack 1.0.0 instances, possibly using XDeriveGeneric ? 回答1: As a stop-gap measure, have a look at the msgpack-aeson directory of the message-pack github repo: https://github.com/msgpack/msgpack-haskell/tree/master/msgpack-aeson You could go from your data values <->

C++ msgpack User-defined classes - can't get started

瘦欲@ 提交于 2019-12-11 08:02:37
问题 I've been looking at the C++ quick-start guide for msgpack. http://wiki.msgpack.org/pages/viewpage.action?pageId=1081387 There, there is the following code snippet: #include <msgpack.hpp> #include <vector> #include <string> class myclass { private: std::string str1; std::string str2; public: MSGPACK_DEFINE(str1,str2); }; int main(void) { std::vector<myclass> vec; // add some elements into vec... ///// /* But what goes here??? */ ///// // you can serialize myclass directly msgpack::sbuffer

Deserialize a type containing a Dictionary property using ServiceStack JsonSerializer

孤者浪人 提交于 2019-12-10 19:13:18
问题 The code snippet below shows two ways I could achieve this. The first is using MsgPack and the second test is using ServiceStack's JSONSerializer. The second is more favourable because the ServiceStack.Text JSONSerializer is used throughout a project I'm working in. Why is the second test below failing when using a Dictionary<Street,HashSet<int>>? [TestFixture] public class NeighbourhoodTests { private Neighbourhood _myNeighbourhood; private Street _street; [SetUp] public void SetupOnEachTest

python 3 will not find key in dict from msgpack

独自空忆成欢 提交于 2019-12-10 18:27:23
问题 why does this happen in python3? 1) I get msgpack data from redis 2) I unpack I get the below 3) The returned type is a dict: meta = msgpack.unpackb(data[1]) print(type(meta)) <class 'dict'> meta = {b'api_key': b'apikey1', b'sensor_id': b'sid1', b'version': b'1.0'} If I run the below: sensor_meta['sensor_id'] {b'api_key': b'apikey1', b'sensor_id': b'sid1', b'version': b'1.0'} Traceback (most recent call last): File "/Users//worker.py", line 247, in <module> print(meta['sensor_id']) KeyError:

Deserializing a heterogeneous map with MessagePack in C++

馋奶兔 提交于 2019-12-10 14:58:47
问题 I’m using MessagePack with C++ and I’m trying to deserialize the equivalent of this Python map: {'metadata': {'date': '2014-06-25', 'user_id': 501}, 'values': [3.0, 4.0, 5.0], 'version': 1} The top-level object is a map with string keys, but the values are of completely different types. My code knows ahead of time what the structure of the object should be; I ought to be able to declare an integer and then tell my deserialization code, “The value of the version key is an integer, so put the