知识卡片

普通读书笔记卡 · 4545.d.11

字段编号是消息兼容契约

理解等级:中级

Protobuf消息把字段映射到稳定编号,类型、编号与重复性共同决定编码解释。已使用编号不应随意更改,删除字段可保留编号防止误用;消息名与服务方法又是不同层次的契约。原书采用proto3,不能仅凭编译成功就证明新旧端语义兼容。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Loose Coupling · 查看原书依据

      each field in a message definition has a field number that is unique for that message type. These are used to identify fields in the message binary format, and should not be changed once your message type is in use. If this raises a “tight coupling” red flag in your mind, you get a gold

    参考来源

    - 位置:《Cloud Native Go》第08章《Loose Coupling》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch08.xhtml) - 结论依据:Protobuf消息把字段映射到稳定编号,类型、编号与重复性共同决定编码解释。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:each field in a message definition has a field number that is unique for that message type. These are used to identify fields in the message binary format, and should not be changed once your message type is in use. If this raises a “tight coupling” red flag in your mind, you get a gold