protocol-buffers

GRPC: Client streaming with configuration message

一世执手 提交于 2019-12-07 08:21:54
问题 Here's a proto definition for a service that consumes a stream of events from a client message Event { // ... } service EventService { rpc Publisher(stream Event) returns (google.protobuf.Empty); } The problem is that the server needs to be told what to do with this stream. Ideally, it would first recieve an Options message: message Event { // ... } message Options { // ... } service EventService { rpc Publisher(Options, stream Event) returns (google.protobuf.Empty); } However, grpc only

Erlang serialization library

。_饼干妹妹 提交于 2019-12-07 06:19:22
问题 Does anybody know good and production ready serialization library for Erlang? I have tried erlang_protobuffs - but it fails on its tests. I don't need to expose methods or anything like this, all I need is to encode/decode messages. Is there anything else worth trying? 回答1: As @Alexey Romanov said, try term_to_binary and binary_to_term . If you are talking between Erlang nodes, you don't even need this, because the Erlang runtime can do this for you transparently. There are also libraries for

How to get structure of a Google Protobuf message without the definition

删除回忆录丶 提交于 2019-12-07 06:04:44
问题 I have to get the message structure of a protobuf message transfered to me without the message's definition. Using UnknownFieldSet methods, I was able to get a string representation of the message as below: 1: "a" 2: { 3:"b" 4:"c" } What data structure does field 2 represent ? Using UnknownFieldSet.Field.getGroupList i was able to get the content of field 3 and 4, does that means field 2 has the "deprecated" group structure ? 回答1: If you posted the raw binary data we could tell you - or you

File does not reside within any path specified using proto_path

て烟熏妆下的殇ゞ 提交于 2019-12-07 05:33:24
问题 I am testing out importing .proto file from another directory. $GOPATH/src/A/A.proto syntax = "proto3"; package A; message SomeMsg { string msg = 2; int64 id = 3; } $GOPATH/src/B/B.proto syntax = "proto3"; package B; import "A/A.proto"; message Msg { SomeMsg s = 1; } I'm doing this: in folder A: protoc A.proto --go_out=. and then in folder B: protoc B.proto --go_out=. --proto_path=$GOPATH/ But I will get this error: B.proto: File does not reside within any path specified using --proto_path

Compiling C++ gRPC for Android

三世轮回 提交于 2019-12-07 05:02:24
问题 How to compile C++ gRPC code for Android? I have seen several tutorials on how Protobuf itself can be compiled using the Android Native Development Kit, such as in the answer from Swapnil: How to integrate/install latest c++ protobuf (3.2) with Android NDK? Or Google protobuf and Android NDK But how to How to compile C++ gRPC code that is using Protobuf as well for Android? Taking into account that there's 20K lines of gRPC Makefile. 来源: https://stackoverflow.com/questions/47997740/compiling

Reading Protobuf objects using boost::asio::read_async

◇◆丶佛笑我妖孽 提交于 2019-12-07 04:59:06
问题 I am writing an application using Boost asio in which the client and the server exchange messages that are serialized using google proto-buffers. I do not know what is the size of the serialized message being sent on over the network. It seems that the proto-buf objects do not have any delimiter. Here are the contents of the .proto file. package tutorial; message Person { required string name = 1; required int32 id = 2; optional string email = 3; } Here is how I am writing from the server

Java Serialization with Protocol Buffer

可紊 提交于 2019-12-07 02:54:46
问题 I want to use protobuff in a Java application to facilitate serialization and I have a question about this quote from the Google web site Protocol Buffers and O-O Design Protocol buffer classes are basically dumb data holders (like structs in C++); they don't make good first class citizens in an object model. If you want to add richer behaviour to a generated class, the best way to do this is to wrap the generated protocol buffer class in an application-specific class. Wrapping protocol

Generate proto file from golang struct

柔情痞子 提交于 2019-12-07 02:46:25
问题 I have a golang struct which contains references to some other structs. Is there an automated way to generate the .proto file from the structs ? For example: type A struct { a int b B } type B struct { c []C } type C struct { x int } should generate: message A, B, C etc. proto3 is preferred. https://github.com/kubernetes/kubernetes/tree/master/cmd/libs/go2idl seems to have something related but is undocumented. Any options ? 回答1: I'm find the package,Generate .proto files from Go source code:

Binary object graph serialization

筅森魡賤 提交于 2019-12-07 02:39:58
问题 I'm looking for advice on serialization in a .net app. The app is a desktop/thick client app and the serialization represents the persisted document format. The requirements for the serializer is Must allow serializing fields, not public properties only. Must not require parameterless constructors. Must handle general object graphs, i.e. not only DAG but shared/bidirectional references. Must work with framework classes (e.g. Serialize Dictionaries). Currently we use the BinaryFormatter which

Compile Protocol Buffers 2.6.1 using VS 2015?

﹥>﹥吖頭↗ 提交于 2019-12-07 02:15:28
问题 I want to use ProtoBuf 2.6.1 with a VS 2015 C++ application. However, I can't link against libprotobuf.lib compiled using VS 2013. I tried to compile libprotobuf.lib again using VS 2015, but am running into compile errors, complaining about <hash_map> and <hash_set> being deprecated. It looks like the cmake files for ProtoBuf at the GitHub repo are now all set up for ProtoBuf 3.0. Is it still possible to compile libprotobuf using VS 2015? 回答1: To get the unit tests running you also need to