As the topic, I want to use thrift rpc functions, while with protobuf for serialization, is there any project that has done this? The reason that I don't want to use thrift serialization is after I see into the cpp files generated, I found it doesn't have _in_place functions, meaning that it has to copy construct every member, while for my case, I have all the char* etc alreadly allocated else where.
Asked
Active
Viewed 1,013 times
2
-
Have a look at the generated code and you'll quickly see that this is mission "impossible", or at least mission "sounds like a lot of work that you don't want to do". Sure, you could write your own Thrift transport, but then you would also have to rewrite the code generator in order to have the generated code properly deal with non-Thrift data objects. And probably some other parts of the library. And make sure you measure the net gain from all those work. – JensG Mar 05 '15 at 18:02
1 Answers
3
The only way you might do this is to declare a Thrift message that contains a large byte blob which you in turn parse as a Protobuf. But, that would require an extra copy, which defeats your purpose.
Note that Google just released GRPC, an RPC protocol for Protobufs. If you are starting a new project and you want to use Protobuf RPC, use that.
You might also be interested in Cap'n Proto, a serialization and RPC system which specializes in avoiding copies.
(Disclosure: I am the author of Cap'n Proto, as well as most of Google's open source Protobuf code, but I have nothing to do with GRPC.)

Kenton Varda
- 41,353
- 8
- 121
- 105