protocol-buffers

How to accomplish inheritance effectively using proto-buffers

扶醉桌前 提交于 2019-12-02 05:15:31
问题 I have a base class message message Animal { optional string name = 1; optional int32 age = 2; } and the sub-class which extends animal message Dog{ optional string breed = 1; } So while building a dog message , i should be able to set all the fields of Animal. I know the round about way of doing it (declaring all the animal fields once again in dog message)but is it possible simply and effectively using protobuffers? Also i learnt about extensions and i understood that it is just used to add

Store a single byte in a protobuf message

泪湿孤枕 提交于 2019-12-02 04:54:08
问题 What data type do I use to store a single byte in a protocol buffer message? Seeing the list at https://developers.google.com/protocol-buffers/docs/proto#scalar it seems like one of the *int32 types are the best fit. Is there a more efficient way to store a single byte? 回答1: Well you need to understand that it will take at least two bytes anyway - one for the tag and one for the data. (The tag will take more space if the field number is high.) If you use uint32 , it will take 1 byte for the

Gradle not able to detect osdetector plugin

萝らか妹 提交于 2019-12-02 04:05:01
问题 I am using OpenSSL for my Java GRPC project which uses gradle. I read the documetation which mentions that we should make security settings as mentioned in this link. I have included the osdetector plugin in the build.gradle file. But when I build the project, gradle is not able to resolve the osdetector plugin and throwing error > Failed to apply plugin [id 'com.google.protobuf'] > Plugin with id 'osdetector' not found. My gradle file is as follows: def neo4jVersion = "2.3.3" apply plugin:

Protobuf-net - serializing .NET GUID - how to read this in C++?

混江龙づ霸主 提交于 2019-12-02 03:52:26
I have serialized an object using Protobuf-net , in my .NET application, with relative ease. I also get the .proto file that protobuf-net generated, using GetProto() command. In the .NET generated .proto file, my GUID fields get a type of "bcl.guid". Now I wish to compile the .proto file in C++ so I can deserialize the data. However, C++ protoc.exe compiler does not know how to interpret bcl.guid, and throws an error message "VideoAudioStructs.proto:11:13: "Guid" is not defined." What do I do with this? protobuf-net encodes this as a pair of fixed-length 64 bit values at fields 1 and 2. I

Why does CodedInputStream set stream position to end?

假装没事ソ 提交于 2019-12-02 03:46:30
I'm using protocol buffers 3 in c#. I'm trying to bounce through a stream to find the start locations of each message, without actually Deserialising the messages. All messages are written to the stream with WriteDelimitedTo . I then use this code to try to jump from length markers: _map = new List<int>(); _stream.Seek(0, SeekOrigin.Begin); var codedStream = new CodedInputStream(_stream); while (_stream.Position < _stream.Length) { var length = codedStream.ReadInt32(); _map.Add((int) _stream.Position); _stream.Seek(length, SeekOrigin.Current); } However, the moment I do codedStream.ReadInt32()

Apache Beam Google Datastore ReadFromDatastore entity protobuf

心已入冬 提交于 2019-12-02 02:42:04
问题 I am trying to use apache beam's google datastore api to ReadFromDatastore p = beam.Pipeline(options=options) (p | 'Read from Datastore' >> ReadFromDatastore(gcloud_options.project, query) | 'reformat' >> beam.Map(reformat) | 'Write To Datastore' >> WriteToDatastore(gcloud_options.project)) The object that gets passed to my reformat function is type google.cloud.proto.datastore.v1.entity_pb2.Entity It is in protobuf format which is hard to modify or read. I think I can convert a entity_pb2

Linking to generated Java protobuf code in Eclipse

寵の児 提交于 2019-12-02 02:18:46
Here's the workflow that I'm trying to build compile my proto files using a script, putting the generated src in a specified directory link to the generated classes in Eclipse compile my project I am easily able to do this for C++ using Eclipse CDT: In my project I choose File->New->Other and choose File under General. Then I click on Advanced and select link to system file. I haven't discovered how to do this for Java, though. Once answer here suggests creating another project with the generated code and make that a dependency to my project. This works but seems redundant. Is there a way to

How to accomplish inheritance effectively using proto-buffers

倖福魔咒の 提交于 2019-12-02 01:44:32
I have a base class message message Animal { optional string name = 1; optional int32 age = 2; } and the sub-class which extends animal message Dog{ optional string breed = 1; } So while building a dog message , i should be able to set all the fields of Animal. I know the round about way of doing it (declaring all the animal fields once again in dog message)but is it possible simply and effectively using protobuffers? Also i learnt about extensions and i understood that it is just used to add a new field to the already existing message and so it should not be misconstrued to be the possible

Gradle not able to detect osdetector plugin

泪湿孤枕 提交于 2019-12-02 01:44:30
I am using OpenSSL for my Java GRPC project which uses gradle. I read the documetation which mentions that we should make security settings as mentioned in this link . I have included the osdetector plugin in the build.gradle file. But when I build the project, gradle is not able to resolve the osdetector plugin and throwing error > Failed to apply plugin [id 'com.google.protobuf'] > Plugin with id 'osdetector' not found. My gradle file is as follows: def neo4jVersion = "2.3.3" apply plugin: 'application' apply plugin: 'java' apply plugin: 'com.google.protobuf' apply plugin: 'idea' apply

Apache Beam Google Datastore ReadFromDatastore entity protobuf

本小妞迷上赌 提交于 2019-12-02 00:13:21
I am trying to use apache beam's google datastore api to ReadFromDatastore p = beam.Pipeline(options=options) (p | 'Read from Datastore' >> ReadFromDatastore(gcloud_options.project, query) | 'reformat' >> beam.Map(reformat) | 'Write To Datastore' >> WriteToDatastore(gcloud_options.project)) The object that gets passed to my reformat function is type google.cloud.proto.datastore.v1.entity_pb2.Entity It is in protobuf format which is hard to modify or read. I think I can convert a entity_pb2.Entity to a dict with entity= dict(google.cloud.datastore.helpers._property_tuples(entity_pb)) But for