Re: [protobuf] Can protocol buffer support partial reading?

2019-05-27 Thread ill W
Yes, I add fields in my new protocol buffers types without changing any 
data type of an existing fields. After I posted my problems, I tried member 
function ParsePartialFromCodedStream in the message class, and it told me 
that I have UnknownFields, and is it the way protocol buffers designed to 
be forwards compatible? I can just use the function provided in 
unknownfield and get what I need?

在 2019年5月28日星期二 UTC+8上午3:03:41,Marc Gravell写道:
>
> What exactly happens? Protocol buffers are designed to be forwards 
> compatible, so adding fields etc is usually fine and expected. Depending on 
> the implementation unexpected fields may be ignored or stored as extension 
> fields. So: is that what you did? And: what happened?
>
> Note: changing the data type (or meaning) of an existing field is *not* 
> forwards compatible.
>
> On Mon, 27 May 2019, 12:26 ill W, > 
> wrote:
>
>> I am using protocol buffer in C++ and I notice that if I use an old 
>> protocol buffer generated code and parse a new protocol buffer file, it 
>> will crash. 
>>
>> Is there any way to partial parse the file like just ignore the 
>> unrecognized structure in my new file and get the supported total file?  
>>
>> For example, If I support new layer in caffe model, can I parse the caffe 
>> model without compiling my code and get all the supported layer in my old 
>> code?
>>
>> I have read the protobuf api and find ParsePartialFromIstream function, 
>> but it still don't work. 
>>
>>
>>  
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to prot...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/protobuf/f65a1540-da98-4813-b012-afad4f665841%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/6865cb5d-063a-4598-a6a0-af7a2461431b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Can protocol buffer support partial reading?

2019-05-27 Thread Marc Gravell
What exactly happens? Protocol buffers are designed to be forwards
compatible, so adding fields etc is usually fine and expected. Depending on
the implementation unexpected fields may be ignored or stored as extension
fields. So: is that what you did? And: what happened?

Note: changing the data type (or meaning) of an existing field is *not*
forwards compatible.

On Mon, 27 May 2019, 12:26 ill W,  wrote:

> I am using protocol buffer in C++ and I notice that if I use an old
> protocol buffer generated code and parse a new protocol buffer file, it
> will crash.
>
> Is there any way to partial parse the file like just ignore the
> unrecognized structure in my new file and get the supported total file?
>
> For example, If I support new layer in caffe model, can I parse the caffe
> model without compiling my code and get all the supported layer in my old
> code?
>
> I have read the protobuf api and find ParsePartialFromIstream function,
> but it still don't work.
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/f65a1540-da98-4813-b012-afad4f665841%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CAF95VAxZjR8g0TLg0n4bqzohYTkPeXEAQnbBKGqY_YjmxipGrA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Can protocol buffer support partial reading?

2019-05-27 Thread ill W
I am using protocol buffer in C++ and I notice that if I use an old 
protocol buffer generated code and parse a new protocol buffer file, it 
will crash. 

Is there any way to partial parse the file like just ignore the 
unrecognized structure in my new file and get the supported total file?  

For example, If I support new layer in caffe model, can I parse the caffe 
model without compiling my code and get all the supported layer in my old 
code?

I have read the protobuf api and find ParsePartialFromIstream function, but 
it still don't work. 


 

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/f65a1540-da98-4813-b012-afad4f665841%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.