知识卡片
工作交接可减少共享标记
轮询URL的示例把“正在轮询”和“上次轮询时间”等共享标记,换成工作在输入与输出通道之间流转。工作者只处理自己收到的对象,协调者控制后续安排,减少每个工作者扫描并锁整张表的逻辑。简化依赖于明确交接,不代表仅发送对象指针就完成所有权约束。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Scalability · 查看原书依据
Resource has been reduced to its essential component (the URL string), and Poller is a function that receives Resource values from an input channel, and sends them to an output channel when they’re done. type Resource string func Poller(in, out chan *Resource) { for r := range in { // Poll the URL // Send
参考来源
- 位置:《Cloud Native Go》第07章《Scalability》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch07.xhtml)
- 结论依据:轮询URL的示例把“正在轮询”和“上次轮询时间”等共享标记,换成工作在输入与输出通道之间流转。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。
- 原始内容:Resource has been reduced to its essential component (the URL string), and Poller is a function that receives Resource values from an input channel, and sends them to an output channel when they’re done. type Resource string func Poller(in, out chan *Resource) { for r := range in { // Poll the URL // Send