Questions tagged [protocol-buffers]

For questions about Google's protocol buffers

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

https://developers.google.com/protocol-buffers

7638 questions
368
votes
4 answers

Why required and optional is removed in Protocol Buffers 3

I'm recently using gRPC with proto3, and I've noticed that required and optional has been removed in new syntax. Would anyone kindly explain why required/optional are removed in proto3? Such kind of constraints just seem necessary to make definition…
yjzhang
  • 4,859
  • 3
  • 19
  • 21
314
votes
15 answers

Biggest differences of Thrift vs Protocol Buffers?

What are the biggest pros and cons of Apache Thrift vs Google's Protocol Buffers?
Bob
236
votes
1 answer

google protocol buffers vs json vs XML

I would like to know the merits & de-merits of Google Protocol Buffers JSON XML I want to implement one common framework for two application, one in Perl and second in Java. So, would like to create common service which can be used by both…
Manoj Kathiriya
  • 3,366
  • 5
  • 19
  • 19
222
votes
3 answers

Can I define a grpc call with a null request or response?

Does the rpc syntax in proto3 allow null requests or responses? e.g. I want the equivalent of the following: rpc Logout; rpc Status returns (Status); rpc Log (LogData); Or should I just create a null type? message Null {}; rpc Logout (Null)…
user578895
220
votes
9 answers

How to define an optional field in protobuf 3

I need to specify a message with an optional field in protobuf (proto3 syntax). In terms of proto 2 syntax, the message I want to express is something like: message Foo { required int32 bar = 1; optional int32 baz = 2; } From my…
MaxP
  • 2,664
  • 2
  • 15
  • 16
193
votes
6 answers

protobuf vs gRPC

I try to understand protobuf and gRPC and how I can use both. Could you help me understand the following: Considering the OSI model what is where, for example is Protobuf at layer 4? Thinking through a message transfer how is the "flow", what is…
lony
  • 6,733
  • 11
  • 60
  • 92
151
votes
1 answer

What's the difference between Protocol Buffers and Flatbuffers?

Both are serialization libraries and are developed by Google developers. Is there any big difference between them? Is it a lot of work to convert code using Protocol Buffers to use FlatBuffers?
mining
  • 3,557
  • 5
  • 39
  • 66
133
votes
6 answers

What are the key differences between Apache Thrift, Google Protocol Buffers, MessagePack, ASN.1 and Apache Avro?

All of these provide binary serialization, RPC frameworks and IDL. I'm interested in key differences between them and characteristics (performance, ease of use, programming languages support). If you know any other similar technologies, please…
andreypopp
  • 6,887
  • 5
  • 26
  • 26
129
votes
4 answers

How to assign to repeated field?

I am using protocol buffers in python and I have a Person message repeated uint64 id but when I try to assign a value to it like: person.id = [1, 32, 43432] I get an error: Assigment not allowed for repeated field "id" in protocol message…
PaolaJ.
  • 10,872
  • 22
  • 73
  • 111
129
votes
16 answers

Installing Google Protocol Buffers on mac

I would like to install the older version of Google Protocol Buffers (protobuf-2.4.1) on Mac using the command line/Terminal app. I tried with brew install protobuf, but the latest version 2.5.0 has been installed. Is it possible to install the…
informatiker
  • 2,769
  • 4
  • 17
  • 13
124
votes
3 answers

Date and time type for use with Protobuf

I'm considering to use Protocol Buffers for data exchange between a Linux and a Windows based system. Whats the recommended format for sending date/time (timestamp) values? The field should be small when serialized.
asgaut
  • 1,353
  • 2
  • 8
  • 9
108
votes
2 answers

TensorFlow saving into/loading a graph from a file

From what I've gathered so far, there are several different ways of dumping a TensorFlow graph into a file and then loading it into another program, but I haven't been able to find clear examples/information on how they work. What I already know is…
Technicolor
  • 1,589
  • 2
  • 17
  • 31
104
votes
5 answers

Protobuf to json in python

I have an object that I de-serialize using protobuf in Python. When I print the object it looks like a python object, however when I try to convert it to json I have all sorts of problems. For example, if I use json.dumps() I get that the object…
exHash
  • 1,165
  • 2
  • 8
  • 12
104
votes
3 answers

What does the protobuf text format look like?

Google Protocol Buffers can not only be serialized in binary format, also be serialized as text, known as textproto. However I can't easily find examples of such text; what would it look like? Expected answer: an example covering all features…
Vi.
  • 37,014
  • 18
  • 93
  • 148
100
votes
11 answers

How to solve "AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key"?

I encountered it while executing from object_detection.utils import label_map_util in jupyter notebook. It is actually the tensorflow object detection tutorial notebook(it comes with the tensorflow object detection api) The complete error…
1
2 3
99 100