protocol-buffers

What's the .proto equivalent of List<T> in protobuf-net?

点点圈 提交于 2019-12-23 20:07:08
问题 To keep some consistency, we use code generation for a lot of our object models, and one of the offshoots of that has been generating the .proto files for ProtocolBuffers via a separate generation module. At this point though, I'm stumped at how to implement the generation for when it happens upon a List<T> object. It looks like this is possible via contracts: [ProtoMember(1)] public List<SomeType> MyList {get; set;} but outside of that, I'm not sure how or if it's possible to do this only

using protobuf as a textual configuraton file

浪子不回头ぞ 提交于 2019-12-23 18:53:25
问题 I recently encountered a very large mission-critical project where all the configuration files were defined using textual protobuf definitions. The configuration files are meant to be human readable and editable. For example message ServerSettings { required int32 port = 3022; optional string name = "mywebserver"; } Personally I found this humorous. But is it in fact a reasonable keep-it-simple technique, or clearly moronic ?! In other words, are there REAL, ACTUAL problems with this ? 回答1:

Compose Protocol buffers (protobuf) definitions hierarchically by referencing other protobuf messages in other repositories or projects or jar files

时间秒杀一切 提交于 2019-12-23 17:46:11
问题 The big picture is that I have a protobuf (think of it like a class) datatype that refers to another protobuf that is within another Jar file that is a dependency in my POM file. This works perfectly for .java files but unfortunately doesn't work for protobuf files. The best solution I can think of is to tell Maven to extract this other dependency Jar (that contain proto files) file in a location and then tell Maven to do a protoc compile of all these proto files in that location. Alas, I

isinstance doesn't work when use reflection of python protobuf v2.6.1

ぐ巨炮叔叔 提交于 2019-12-23 13:19:09
问题 I am using dynamic reflection functionality of python protobuf v2.6.1, and have a function like below: # initilization code des_db_ = descriptor_database.DescriptorDatabase() des_pool_ = descriptor_pool.DescriptorPool(des_db_) fdp = descriptor_pb2.FileDescriptorProto.FromString( a_pb_module.DESCRIPTOR.serialized_pb) des_db_.Add(fdp) def unpack_PB_msg(type_name, pb_msg_str) factory = message_factory.MessageFactory(des_pool_) msg_class = factory.GetPrototype(des_pool_.FindMessageTypeByName(type

Is it possible to use Apache Thrift without RPC?

早过忘川 提交于 2019-12-23 12:38:05
问题 I searched on the internet but couldn't find anything useful. First, I was thinking to use Protocol Buffers but it doesn't provide built in feature to track multiple messages (where one message finish and second starts) or message self delimiting, but I read about this feature in Thrift white paper and it seems good to me. Now I am thinking to use Thrift instead of Protocol Buffers. I am working on custom protocol for that I don't require RPC, could someone suggest if I can use Thrift without

RPC with protocol buffers

别等时光非礼了梦想. 提交于 2019-12-23 12:06:22
问题 I'm tring to make rpc with protocol buffers and zeromq. Here is my proto file: message SearchRequest { required string query = 1; } message SearchResponse { repeated Result result = 1; } message Result { required string url = 1; optional string title = 2; repeated string snippets = 3; } service SearchService { rpc Search (SearchRequest) returns (SearchResponse); } According to the tutorial I should get some service interface code and stubs for this rpc but I don't. Did I misunderstand

Protobuf-net possible recursion detected: serialize children and parents

柔情痞子 提交于 2019-12-23 11:58:06
问题 I am new to serialization in general, and even newer to protobuf. Here is my problem, I have these classes: [ProtoContract] class Controle { [ProtoMember(1, AsReference=true)] public HashSet<Controle> ControlesInternes { get; set; } [ProtoMember(2)] public string TypeControle { get; set; } [ProtoMember(3)] public Dictionary<string, string> Attributs { get; set; } [ProtoMember(4)] public int Ligne { get; set; } [ProtoMember(5)] public string InnerText { get; set; } [ProtoMember(6)] public

Why is ProtoBuf so slow on the 1st call but very fast inside loops?

▼魔方 西西 提交于 2019-12-23 11:53:07
问题 Inspired from this question. I created a small benchmark program to compare ProtoBuf, BinaryFormatter and Json.NET. The benchmark itself is a small console based one at https://github.com/sidshetye/SerializersCompare .Feel free to add/improve, it's quite simple to add a new serializer to the mix. Anyway, my results are: Binary Formatter ProtoBuf Json.NET ServiceStackJson ServiceStackJSV Loop Size:512 bytes Size:99 bytes Size:205 bytes Size:205 bytes Size:181 bytes 1 16.1242 ms 151.6354 ms 277

Why is ProtoBuf so slow on the 1st call but very fast inside loops?

你离开我真会死。 提交于 2019-12-23 11:52:27
问题 Inspired from this question. I created a small benchmark program to compare ProtoBuf, BinaryFormatter and Json.NET. The benchmark itself is a small console based one at https://github.com/sidshetye/SerializersCompare .Feel free to add/improve, it's quite simple to add a new serializer to the mix. Anyway, my results are: Binary Formatter ProtoBuf Json.NET ServiceStackJson ServiceStackJSV Loop Size:512 bytes Size:99 bytes Size:205 bytes Size:205 bytes Size:181 bytes 1 16.1242 ms 151.6354 ms 277

Protocol buffer polymorphism

最后都变了- 提交于 2019-12-23 10:14:19
问题 I have a C++ program that sends out various events, e.g. StatusEvent and DetectionEvent with different proto message definitions to a message service (currently Active MQ, via activemq-cpp APU). I want to write a message listener that receives these messages, parses them and writes them to cout, for debugging purposes. The listener has status_event_pb.h and detection_event_pb.h linked. My question is: How can I parse the received event without knowing its type? I want to do something like (in