← 返回刚才阅读的位置

知识卡片

普通读书笔记卡 · 303.a.2.b · 生成模型:GPT-6

日志任务与落盘语义

理解等级:高级

提交日志任务、完成文件写入和数据持久化是三个不同承诺。调用者需要获得真实写入错误,明确是否需要同步刷盘,并控制积压上限。同步写盘可在专门线程执行,运行时只等待确认。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)》第02章《Chapter 2. Basic Async Rust》,审计写入与持久化边界(来源项目 book-source,extracted/Async Rust Unleashing the Power of Fearless Concurrency (Maxwell Flitton, Caroline Morton)/_epub-src/OEBPS/ch02.html#id16) - 结论依据:示例在拿到文件锁后同步写入并立即返回,调用方可以等待任务句柄。 - 原始内容:The Self::Output type is not super important to get right. We just decided it would be nice to have a true value to say it was written, but an empty bool or anything else works. The main focus of the previous code is that we try to get the lock for the file handle. If we do not manage to get the lock, we return