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
74
votes
2 answers

Inheritance in protocol buffers

How to handle inheritance in Google Protocol Buffers 3.0? Java equivalent code: public class Bar { String name; } public class Foo extends Bar { String id; } What would be Proto equivalent code? message Bar { string name =…
Vivek Sinha
  • 1,591
  • 3
  • 15
  • 23
74
votes
15 answers

Unable to build protobuf to go endpoint

using protobuf version 2.6.1 ( which i installed via homebrew) I am trying to run $ protoc --go_out=../cloud/ *.proto I keep receiving this error. $ protoc-gen-go: program not found or is not executable $ --go_out: protoc-gen-go: Plugin failed…
R.J. Robinson
  • 2,180
  • 3
  • 21
  • 33
73
votes
3 answers

AttributeError: Assignment not allowed to composite field "task" in protocol message object

I'm using protocol-buffers python lib to send data,but it's have some problems, so Traceback (most recent call last): File "test_message.py", line 17, in ptask.task = task File…
gezhonglunta
  • 1,301
  • 3
  • 13
  • 17
71
votes
2 answers

Splitting protocol buffer definitions into multiple .proto files

I would like to include a protocol definition file in another protocol file. For example: // base.proto: message P_EndPoint { required int32 id = 1; required string host = 2; required int32 port = 3; } Then in another…
sorush-r
  • 10,490
  • 17
  • 89
  • 173
70
votes
8 answers

Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?

We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as…
Parand
  • 102,950
  • 48
  • 151
  • 186
70
votes
11 answers

Are there C++ equivalents for the Protocol Buffers delimited I/O functions in Java?

I'm trying to read / write multiple Protocol Buffers messages from files, in both C++ and Java. Google suggests writing length prefixes before the messages, but there's no way to do that by default (that I could see). However, the Java API in…
tzaman
  • 46,925
  • 11
  • 90
  • 115
69
votes
11 answers

boost serialization vs google protocol buffers?

Does anyone with experience with these libraries have any comment on which one they preferred? Were there any performance differences or difficulties in using?
68
votes
3 answers

How to encode byte[] in proto buffs

Is there an equivalent to int8 or byte type in proto buffs? I would like to send a byte array object.
Usman Ismail
  • 17,999
  • 14
  • 83
  • 165
66
votes
8 answers

Generate Protobuf documentation?

Does anyone know of a good tool to generate Google Protobuf documentation using the .proto source files?
66
votes
1 answer

Protocol buffer: does changing field name break the message?

With protocol buffer, does changing field name of a message still let it compatible backward? I couldn't find any cite about that. Eg: original message message Person { required string name = 1; required int32 id = 2; optional string email =…
tiboo
  • 8,213
  • 6
  • 33
  • 43
66
votes
1 answer

Protobuf: Will set_allocated_* delete the allocated object?

I have this small protobuf code (simplified, only the necessary is contained): message ParamsMessage { required int32 temperature = 1; } message MasterMessage { enum Type { GETPARAMS = 1; SENDPARAMS = 2;} required Type type = 1; …
Nidhoegger
  • 4,973
  • 4
  • 36
  • 81
65
votes
6 answers

what's the right way to do polymorphism with protocol buffers?

I'm trying to long-term serialize a bunch of objects related by a strong class hierarchy in java, and I'd like to use protocol buffers to do it due to their simplicity, performance, and ease of upgrade. However, they don't provide much support for…
user364003
  • 651
  • 1
  • 5
  • 3
62
votes
1 answer

How to add an int array in a protobuf message

I have to compose a protobuf message which should have 1 integer variables and a integer array. package protobuf; message myProto { optional uint32 message_id =1; optional int update = 2; //here I have to add a array of integers //can I write like…
javaMan
  • 6,352
  • 20
  • 67
  • 94
62
votes
1 answer

Is there a definitive *nix command line tool for inspecting protocol buffers?

I'm looking for a command-line utility that will, at a minimum, render binary protobuf data in human-readable form. Filtering and selection options (along the lines of cut for text) would be nice, but the primary object is to make the data visible…
comingstorm
  • 25,557
  • 3
  • 43
  • 67
61
votes
2 answers

Protocol buffers - unique numbered tag - clarification?

I'm using protocol buffers and everything is working fine. except that the fact that I don't understand - why do I need the numbered tags in the proto file : message SearchRequest { required string query = 1; optional int32 page_number = 2; …
Royi Namir
  • 144,742
  • 138
  • 468
  • 792