Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dictionary in protocol buffers

Is there any way to serialize a dictionary using protocol buffers, or I'll have to use Thrift if I need that?

like image 441
ibz Avatar asked Nov 16 '10 13:11

ibz


People also ask

Does Protobuf support dictionary?

Protobuf specification now supports dictionaries (maps) natively.

What are protocol buffers used for?

Protocol Buffers (Protobuf) is a free and open-source cross-platform data format used to serialize structured data. It is useful in developing programs to communicate with each other over a network or for storing data.

Is protocol buffers a language?

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.

What is oneof in Protobuf?

Protocol Buffer (Protobuf) provides two simpler options for dealing with values that might be of more than one type. The Any type can represent any known Protobuf message type. And you can use the oneof keyword to specify that only one of a range of fields can be set in any message.


1 Answers

For future answer seekers, ProtoBuf now supports Maps natively:

message MapMessage {     map<string, string> MyMap = 1; } 
like image 138
Flassari Avatar answered Sep 28 '22 06:09

Flassari