I don't quite understand your question.  It's safe to add new fields to a
protocol buffer.
If you want to store all the values as one unit -- for instance, so that old
releases that don't know about new fields still know that the fields
represent the same "column" -- you could always wrap them in another message
like:
message A {
  required UserUnion user = 1;
}

message UserUnion {
  optional B b = 1;
  optional C c = 2;
  optional D d = 3;
}

Code which just passes around UserUnion objects without looking inside will
work even if

On Wed, Oct 21, 2009 at 6:19 PM, SuKai <sukai090...@gmail.com> wrote:

> I release this proto at R1:
> message A {
> optional B user_b = 1;
> optional C user_c = 2;
> optional D user_d = 3;
> }
>
> but if I find some fault with this proto or extend this proto at R2:
> message A {
> optional B user_b = 1;
> optional C user_c = 2;
> optional E user_d = 3;
> optional F user_e = 4;
> }
>
> So , I want use R1's proto instance to encode this message on R2' proto
> instance.
> Can I get the true value for the same colums (user_b & user_c) value?
>
> Thanks.
>
>
> Kenton Varda 写道:
>
>  On Wed, Oct 21, 2009 at 6:04 PM, SuKai <sukai090...@gmail.com <mailto:
>> sukai090...@gmail.com>> wrote:
>>
>>    Because A_instance.user stored with different type of PB.
>>
>>    Fill A_instance.user with B, C, or D , these are diff PB objects.
>>
>>
>> Then you should have three different fields:
>>
>> message A {
>> optional B user_b = 1;
>> optional C user_c = 2;
>> optional D user_d = 3;
>> }
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to