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

Is there ever a good time to use int32 instead of sint32 in Google Protocol Buffers?

I've been reading up on Google Protocol Buffers recently, which allows for a variety of scalar value types to be used in messages. According to their documentation, there's three types of variable-length integer primitives - int32, uint32, and…
Dan Lew
  • 85,990
  • 32
  • 182
  • 176
39
votes
5 answers

protoc: command not found (Linux)

I am trying to use Protobuf on Linux box. I downloaded the pre-compiled from github. When I try to compile my .proto file or just check the protobuf version, it says protoc: command not found. I tried the same steps on Windows machine using…
sgmbd
  • 493
  • 1
  • 6
  • 16
39
votes
6 answers

Google protocol buffers compare

I want to compare two Messages or (two sub parameters) of Google protocol buffers. I don't find an API to achieve it. Any ideas?
dimba
  • 26,717
  • 34
  • 141
  • 196
38
votes
6 answers

Why isn't Hadoop implemented using MPI?

Correct me if I'm wrong, but my understanding is that Hadoop does not use MPI for communication between different nodes. What are the technical reasons for this? I could hazard a few guesses, but I do not know enough of how MPI is implemented "under…
artif
  • 907
  • 1
  • 7
  • 12
38
votes
9 answers

golang protobuf remove omitempty tag from generated json tags

I am using google grpc with a json proxy. for some reason i need to remove the omitempty tags from the struct generated in the *.pb.go files. if i have a proto message like this message Status { int32 code = 1; string message = 2; } The…
sadlil
  • 3,077
  • 5
  • 23
  • 36
37
votes
2 answers

How to share Protobuf definitions for gRPC?

Since you have to share .proto files to define data and services for gRPC, service provider and clients need to access the same .proto files. Is there any common strategy to distribute these files? I want to avoid that every project has its own…
Milgo
  • 2,617
  • 4
  • 22
  • 37
37
votes
3 answers

How are protocol-buffers faster than XML and JSON?

I recently started reading and employing gRPC in my work. gRPC uses protocol-buffers internally as its IDL and I keep reading everywhere that protocol-buffers perform much better, faster as compared to JSON and XML. What I fail to understand is -…
gravetii
  • 9,273
  • 9
  • 56
  • 75
37
votes
2 answers

Why protobuf is bad for large data structures?

I'm new to protobuf. I need to serialize complex graph-like structure and share it between C++ and Python clients. I'm trying to apply protobuf because: It is language agnostic, has generators both for C++ and Python It is binary. I can't afford…
random
  • 3,868
  • 3
  • 22
  • 39
37
votes
9 answers

How to add global exception interceptor in gRPC server?

In gRPC , how to add a global exception interceptor that intercepts any RuntimeException and propagate meaningful information to the client ? for example , a divide method may throw ArithmeticException with / by zero message . In the server side , I…
smallufo
  • 11,516
  • 20
  • 73
  • 111
37
votes
5 answers

Are there any databases that support protocol buffers?

Are there any databases, in either the SQL or NoSQL worlds, that support protocol buffers? (Support could mean various things, but hopefully would include being able to index on fields in protocol buffers.)
Rob Lachlan
  • 14,289
  • 5
  • 49
  • 99
37
votes
2 answers

How does protobuf-net achieve respectable performance?

I want to understand why the protocol buffers solution for .NET developed by Marc Gravell is as fast as it is. I can understand how the original Google solution achieved its performance: it pre-generates optimized code for object serialization;…
MichaelT
  • 7,574
  • 8
  • 34
  • 47
37
votes
3 answers

What is the best approach for serializing BigDecimal/BigInteger to ProtocolBuffers

I am starting to migrate a custom serialization mechanism to Protocol Buffers. One data type that will be used particularly regularly is BigDecimal. Does anyone know of a good way of serializing this within Protocol Buffers? Our current…
Rich
  • 15,602
  • 15
  • 79
  • 126
36
votes
1 answer

How to mark rpc as deprecated

If I have a service like this: service MyService { rpc GetThings(GetThingsRequest) returns (GetThingsResponse); } How would I mark GetThings as deprecated? I know how to mark fields or messages as deprecated but I can't find any information about…
Jan Hančič
  • 53,269
  • 16
  • 95
  • 99
36
votes
4 answers

Getting all field names from a protocol buffer?

I want to get all the field names of a proto into a list. Is there a way to do this? I looked in the documentation and there doesn't seem to be anything for this.
user2253332
  • 797
  • 3
  • 12
  • 21
36
votes
3 answers

How do you add a repeated field using Google's Protocol Buffer in C++?

I have the below protocol buffer. Note that StockStatic is a repeated field. message ServiceResponse { enum Type { REQUEST_FAILED = 1; STOCK_STATIC_SNAPSHOT = 2; } message StockStaticSnapshot { repeated…
aajkaltak
  • 1,437
  • 4
  • 20
  • 28