是否可以同时进行非数字函数并抗失败?

发布于 2025-02-05 17:12:23 字数 366 浏览 2 评论 0原文

我尝试设计一个掌握功能,该功能将在使用非数字的同时抗拒并发系统中的故障。

我已经能够与A一起工作

if lockAcquired 
    then : execute the non-idempotent function 
           write result
    else : wait until result available
           read result
return result

,但是假设“写作”线程在获取锁和编写结果之间不会失败。

是否有一些已知的算法可以解决此问题? (我想这将是一种完全不同的方法)

为了理解问题,非数字功能的一个示例将是“发送电子邮件”。

I try to design an idempotent function that would resist to failures in a concurrent system while making use of a non-idempotent one.

I've been able to get something working with a

if lockAcquired 
    then : execute the non-idempotent function 
           write result
    else : wait until result available
           read result
return result

But it assumes that the "writing" thread doesn't fail between acquiring the lock and writing the result.

Are there some known algorithm out there that solve this problem ? (I guess it would be a totally different approach)

In order to reason about the problem, an example of non-idempotent function would be "sending an email".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文