知识卡片
透传代理保存完整快照
局部编辑代理可对外只暴露地址字段,却在内部保存完整人员响应及ETag。收到地址修改后,把字段映射回持有的完整记录,携原版本条件交给来源验证;不能把未展示字段丢掉。
代理表示与来源表示分别维护自己的ETag、URL和标识映射,二者不能混用。来源写入冲突要正确传回;来源缺少代理承诺字段时可返回502并隐藏内部拓扑。此模式是[[未知字段保留往返]]在中间服务上的另一种实现。
结构图:
sequenceDiagram
participant 消费者
participant 地址代理
participant 人员来源
消费者->>地址代理: 请求地址
地址代理->>人员来源: 读取完整人员响应
人员来源-->>地址代理: 完整记录与来源ETag
地址代理-->>消费者: 地址视图与代理ETag
消费者->>地址代理: 带代理条件的地址修改
地址代理->>人员来源: 合并完整记录并带来源条件写入
人员来源-->>地址代理: 成功或版本冲突
地址代理-->>消费者: 对应结果
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 分布式数据 · 查看原书依据
A key element of this recipe is to be sure that pass-through proxies keep track of the connection between the “downstream” (source) record and the “upstream” (exposed) record. To do this, be sure to always store a complete copy of the “downstream” record, including metadata fields such as ETag and other related resource integrity information.
参考来源
- 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第6章《分布式数据》§6.13(来源项目:book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch06.xhtml)
- 结论依据:原文以局部编辑代理可对外只暴露地址字段,却在内部保存完整人员响应及ETag的方式说明该用途;同节示例与讨论补充了卡内条件和边界。
- 原始内容:A key element of this recipe is to be sure that pass-through proxies keep track of the connection between the “downstream” (source) record and the “upstream” (exposed) record. To do this, be sure to always store a complete copy of the “downstream” record, including metadata fields such as ETag and other related resource integrity information.