protocol-buffers

Inheritance in protocol buffers

独自空忆成欢 提交于 2019-12-03 09:35:33
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 = 1; } message Foo { string id = 2; } Protocol Buffers does not support inheritance. Instead, consider using composition: message Foo { Bar bar = 1; string id = 2; } However, that said, there is a trick you can use which is like inheritance -- but which is an ugly hack, so you should only use it with care. If you define your message types like: message Bar { string name = 1; }

Facing NoSuchMethodError for io.netty.util.AttributeKey.valueOf() method with grpc and protobuf Hello world example

青春壹個敷衍的年華 提交于 2019-12-03 09:23:39
After running GreetingServerTest.java tests I am getting below given errors. I am using grpc 1.1.0-SNAPSHOT libraries and trying to implement basic Helloword example of grpc given in there git repo. Can anybody please suggest which libraries I am missing or there's anything else I need to do. java.lang.NoSuchMethodError: io.netty.util.AttributeKey.valueOf(Ljava/lang/Class;Ljava/lang/String;)Lio/netty/util/AttributeKey; at io.grpc.netty.Utils.<clinit>(Utils.java:87) at io.grpc.netty.NettyServer.allocateSharedGroups(NettyServer.java:187) at io.grpc.netty.NettyServer.start(NettyServer.java:116)

Protocol buffer objects generated at runtime

时光毁灭记忆、已成空白 提交于 2019-12-03 09:16:59
问题 a colleague of mine came with an idea of generating protocol buffers classes at runtime. Meaning: There is C++ server application and Java client application communicating over TCP/IP via protocol buffers messages. The C++ application may have different schema in different versions and this is not necessarily backward compatible There is Java application communicating with this server which should support all possible server versions. The idea is that the server sends the protocol buffer's

Google Protocol Buffers or something similar for .net/javascript

倾然丶 夕夏残阳落幕 提交于 2019-12-03 08:54:39
We are currently using Ajax calls to a .net web service that then returns a Json object to the client. Some of these Json objects are pretty massive (> 500k uncompressed). We have heard some good things about Google Protocol Buffers and have been experimenting. So far, we have had pretty good luck serializing on the server with what seems to be the most common .net version - "protobuf-net". We have not had much luck deserializing on the client. We tried using what seems to be the one and only javascript deserializer protobuf.js. We found that it is not easy to use, there are very few examples

Protocol buffers and UTF-8

帅比萌擦擦* 提交于 2019-12-03 08:50:26
The history of Encoding Schemes / multiple Operating Systems and Endian-nes have led to a mess in terms of encoding all forms of string data (--i.e., all alphabets); for this reason protocol buffers only deals with ASCII or UTF-8 in its string types, and I can't see any polymorphic overloads that accept the C++ wstring. The question then is how is one expected to get a UTF-16 string into a protocol buffer ? Presumably I need to keep the data as a wstring in my application code and then perform a UTF-8 conversion before I stuff it into (or extract from) the message. What is the simplest -

C++ Protobuf to/from JSON conversion [closed]

一个人想着一个人 提交于 2019-12-03 08:44:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Is anyone familiar with a stable C++ solution (library, code snippet etc.) which converts protobuf messages to/from JSON? 回答1: This one is better IMO: https://github.com/shramov/json2pb it does conversion in both directions and handles extensions 回答2: pbjson is another one, which built on rapidjson, maybe faster

Convert Keras model to TensorFlow protobuf

最后都变了- 提交于 2019-12-03 08:36:00
问题 We're currently training various neural networks using Keras, which is ideal because it has a nice interface and is relatively easy to use, but we'd like to be able to apply them in our production environment. Unfortunately the production environment is C++, so our plan is to: Use the TensorFlow backend to save the model to a protobuf Link our production code to TensorFlow, and then load in the protobuf Unfortunately I don't know how to access the TensorFlow saving utilities from Keras, which

protocol buffers - store an double array, 1D, 2D and 3D

瘦欲@ 提交于 2019-12-03 07:48:20
问题 How can be an array of double (1D) stored using protocol buffer? What about multi-dimensional (2D or 3D) dense arrays? 回答1: An array of double would be best stored via repeated double foo = 5 [packed=true]; repeated makes it act as a list, allowing multiple items; packed avoids a header per item. There is no direct support for rectangular (or higher) arrays in protobuf. The closest is to store something like: repeated innerType foo = 5; // note, can't be "packed" message innerType { repeated

What the best ways to use decimals and datetimes with protocol buffers?

自古美人都是妖i 提交于 2019-12-03 07:26:48
I would like to find out what is the optimum way of storing some common data type that were not included in the list supported by protocol buffers. datetime (seconds precision) datetime (milliseconds precision) decimals with fixed precision decimals with variable precision lots of bool values (if you have lots of them it looks like you'll have 1-2 bytes overhead for each of them due to their tags. Also the idea is to map them very easy to corresponding C++/Python/Java data types. The protobuf design rationale is most likely to keep data type support as "native" as possible, so that it's easy

How to decode binary/raw google protobuf data

↘锁芯ラ 提交于 2019-12-03 07:14:09
问题 I have a coredump with encoded protobuf data and I want to decode this data and see the content. I have the .proto file which defines this message in raw protocol buffer. My proto file looks like this: $ cat my.proto message header { required uint32 u1 = 1; required uint32 u2 = 2; optional uint32 u3 = 3 [default=0]; optional bool b1 = 4 [default=true]; optional string s1 = 5; optional uint32 u4 = 6; optional uint32 u5 = 7; optional string s2 = 9; optional string s3 = 10; optional uint32 u6 =