gpt4 book ai didi

protocol-buffers - 谷歌 protobuf : if I add field from one side will it break another one?

转载 作者:行者123 更新时间:2023-12-03 18:38:03 26 4
gpt4 key购买 nike

我有两个微服务。第一个服务使用 google protobuf 对消息进行编码( google docs ) 并发送到第二个。第二个解码此消息并使用数据。

现在我需要向这个消息对象添加一个字段。如果我只在一侧进行,它会破坏另一侧吗?

例如,如果我向 json 添加一些东西这不会破坏任何东西。和google protobuf真的一样吗? ?

最佳答案

引自 Goole Protobuf 文档,介绍了从 here 扩展 Protobuf :

you must not change the tag numbers of any existing fields.
you must not add or delete any required fields.
you may delete optional or repeated fields.
you may add new optional or repeated fields but you must use fresh tag numbers (i.e. tag numbers that were never used in this protocol buffer, not even by deleted fields).

在您的情况下,如果您在一侧的更改没有违反上述任何规则,则不会破坏另一侧。

关于protocol-buffers - 谷歌 protobuf : if I add field from one side will it break another one?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45854645/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com