知识卡片

普通读书笔记卡 · 2313.e.5.p.6

装饰器转换请求边界

理解等级:中级

轻量函数可在请求进入主服务前补默认值、校验或转换,也可加工响应;这种装饰把横切变换与业务处理分开。若装饰负载很小,独立函数可避免像同机适配器那样与应用等比例扩展。必须按字段是否缺失或显式为空定义默认规则,不能把JSON空值普遍等同false。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Designing Distributed Systems, 2nd Edition》第09章《Chapter 9. Functions and Event-Driven Processing》(来源项目 book-sources;源文件:extracted/Designing Distributed Systems, 2nd Edition/_epub-src/OEBPS/ch09.html) - 结论依据:原文以补默认值说明输入变换和独立扩展的用途。 - 原始内容:FaaS is ideal for deploying simple functions that can take an input, transform it into an output, and then pass it on to a different service. This general pattern can be used to augment or decorate HTTP requests to or from a different service. A basic illustration of