Protobuf backward compatibility and proto3 vs prot

2019-05-20 07:29发布

One of selling points of Protobuf was backward compatibility, i.e. developers can evolve format, and older clients can still use it.

Now with new Protobuf version called proto3, the IDL language itself is not compatible as such things as options, required where dropped, new syntax for enuns, no extention.

Does it mean that using proto3 there's no way to produce binary that older proto2 would read/understand also?

It is like you have to continue to use proto2. If you start using proto3, you can't talk to older systems, or have to rewrite, recompile all those .protos That is compatibility break in the first place.

1条回答
何必那么认真
2楼-- · 2019-05-20 07:39

Yes, if some of your systems are proto2 based, it is probably best to keep using proto2. In my opinion, proto3 does not introduce many new features and most libraries will continue supporting proto2.

However, the wire format is mostly compatible. As long as the tag number is the same, the encoding remains the same. The required/optional specifiers do not affect the encoding, they are only checks that are performed after decoding.

查看更多
登录 后发表回答