protocol-buffers

Protobuf-net .proto file generation for inheritance

自闭症网瘾萝莉.ら 提交于 2019-11-30 16:02:10
问题 I am prototyping Protobuf-net to replace some of our existing C# code which is currently using [Datacontract] to Serialize objects to Xml. Using protobuffer we can easily share data with Java. I am thus very interested in the .proto file generation of Protobuf-net. This worked well for almost all the use cases I tested so far. But now with inheritance it's a different ball game. The .proto file that's been generated for the Inherited classes is very simple - not including any of the fields

Protobuf-net .proto file generation for inheritance

微笑、不失礼 提交于 2019-11-30 15:42:54
I am prototyping Protobuf-net to replace some of our existing C# code which is currently using [Datacontract] to Serialize objects to Xml. Using protobuffer we can easily share data with Java. I am thus very interested in the .proto file generation of Protobuf-net. This worked well for almost all the use cases I tested so far. But now with inheritance it's a different ball game. The .proto file that's been generated for the Inherited classes is very simple - not including any of the fields for the Base Class. The inheritance itself is working fine in C# - I can read the generated byte stream

Android protobuf nano documentation

徘徊边缘 提交于 2019-11-30 14:39:03
I am trying to reduce the number of methods that are generated by Google proto-buf and one of the alternatives is to use proto-buf nano. However I found no documentation on how to use it. Except the package link , I can't find anything on how to generate java files from proto files using nano. So the question is straight-forward: how to use google proto nano in order to generate java classes from proto files and how to use them in a project? Looking at the main protobuf compiler source code: #include <google/protobuf/compiler/javanano/javanano_generator.h> .... int main(int argc, char* argv[])

Importing “google/protobuf/descriptor.proto” in java protocol buffers

主宰稳场 提交于 2019-11-30 14:17:59
I have a .proto file definition which needs to import "google/protobuf/descriptor.proto" because I use Custom Options . So in my .proto file I do: import "google/protobuf/descriptor.proto"; package ...; ... Since my file didn't compile complaining about the dependency, I got a copy of the descriptor.proto file placing it in the same directory my proto file was. This solved the problem but I don't believe this is the correct way. Now the descriptor.proto gets compiled together with my .proto file resulting in having 2 compiled descriptor.proto at runtime: the one shipped with the protobuf-java

Protocol buffers for JavaScript?

末鹿安然 提交于 2019-11-30 11:55:37
问题 Is there a way to do protocol buffers in JavaScript? Why for .js? If you think about sciencey requirements for a moment, situations pop up where you might want to send a large block of data to the client. With CRUD-style it doesn't really matter so much what you use. With sciencey stuff it does matter (at least I think it does). tradeoffs: protobuffs balances compactness, serialize and deserialize speeds well. text based protocols (xml / json) have a larger message size... but with javascript

Splitting protocol buffer definitions into multiple .proto files

微笑、不失礼 提交于 2019-11-30 10:49:51
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 file: communication.proto: // somehow include `base.proto' // ... message P_CommunicationProtocol { required CP_MessageType type = 1; optional int32 id = 2; optional P_EndPoint identity = 3; repeated P_EndPoint others = 4; } // ... (Note: developers.google.com is not available in my locale) import "myproject/base.proto"; Docs: http://developers.google.com/protocol-buffers/docs

Conflict Protobuf version when using Opencv and Tensorflow c++

孤街醉人 提交于 2019-11-30 09:21:43
I am currently trying to use Tensorflow's shared library in a non-bazel project, so I creat a .so file from tensorflow using bazel. but when I launch a c++ program that uses both Opencv and Tensorflow, it makes me the following error : [libprotobuf FATAL external/protobuf/src/google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.1.0). Contact the program author for an update. If you compiled the program yourself, make sure that your headers are from the same version of

Combining Google proto buffers with Jersey/JAX-RS

。_饼干妹妹 提交于 2019-11-30 08:32:13
Currently I have a RESTful web service with endpoints that are exposed via Jersey/JAX-RS: @Path("/widgets") public class WidgetResource { @GET List<Widget> getAllWidgets() { // gets Widgets somehow } @POST Widget save(Widget w) { // Save widget and return it } } I use Jackson for serializing/deserializing my POJOs into JSON, and my service both responds to and sends back my POJOs as application/json . I am now looking to possibly use Google protocol buffers (or an equivalent technology) to help compress/optimize the communication between client and service, as JSON/text is pretty bulky

How to add metadata to nodejs grpc call

≯℡__Kan透↙ 提交于 2019-11-30 08:04:54
问题 I'd like to know how to add metadata to a nodejs grpc function call. I can use channel credentials when making the client with var client = new proto.Document('some.address:8000', grpc.credentials.createInsecure() ) Which are send when using client.Send(doc, callback) , but the go grpc server looks in the call metadata for identification information which I have to set. I tried using grpc.credentials.combineChannelCredentials with the insecure connection and a grpc.Metadata instance but I can

How to detect when a Protocol Buffer message is fully received?

泄露秘密 提交于 2019-11-30 07:27:53
This is kind of a branch off of my other question . Read it if you like, but it's not necessary. Basically, I realized that in order to effectively use C#'s BeginReceive() on large messages, I need to either (a) read the packet length first, then read exactly that many bytes or (b) use an end-of-packet delimiter. My question is, are either of these present in protocol buffers? I haven't used them yet, but going over the documentation it doesn't seem like there is a length header or a delimiter. If not, what should I do? Should I just build the message then prefix/suffix it with the length