stact 框架入门

发布于 2024-10-28 10:48:07 字数 167 浏览 6 评论 0原文

我一直在查看 Topshelf 代码,并注意到它正在使用名为“stact.dll”的程序集。似乎没有太多关于这方面的信息。它似乎是一个使用参与者和“通道”构建并发应用程序的库。我发现 Topshelf 代码有点难以理解,但我有兴趣了解有关这种编程风格的更多信息。有人有过这个图书馆的经验吗?您是如何开始学习如何使用它的?

I have been looking through the Topshelf code, and notice that it is using an assembly called 'stact.dll'. There does not seem to be a lot of information around on this. It seems to be a library for building concurrent applications using actors and 'channels'. I find the Topshelf code a bit hard to follow, but I am interested in finding out more about this style of programming. Has anyone had any experience with this library? How did you go about learning how to use it?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小兔几 2024-11-04 10:48:07

Stact 目前仅在内部真正使用。这是我们从编写并发软件的经验中积累起来的,主要是 Chris Patterson 的工作 (https://github.com/hatboyg/Stact")。 com/phatboyg/Stact)。

我能想到的最简单的例子来自 Cashbox。
https://github.com/Cashbox/Cashbox /blob/v1.0/src/Cashbox/Engines/FileStorageEngine.cs

您有一个传递消息的通道。在该频道的一端,您可以设置消息订阅。第 72 行构建订阅,为其期望的每种消息类型设置处理程序操作。 HandleOnFiber(_ Fiber) 强制所有消息在同一线程上处理,并且它们在接收时排队。还有其他句柄调用,希望 API 易于发现。

现在,此示例隐藏了一个类中的所有通道和光纤,您可能有连接不同类的通道,在这种情况下,必须传递对相关通道的引用。

Stact 确实是一个 Actor 库。目前还没有任何很好的例子来使用它来编写演员。我希望这有帮助。

Stact is currently only really used internally at the moment. It's something we've built up from our experiences writing concurrent software and mostly the work of Chris Patterson (https://github.com/phatboyg/Stact).

The simplest example I can think of that's out there is from Cashbox.
https://github.com/Cashbox/Cashbox/blob/v1.0/src/Cashbox/Engines/FileStorageEngine.cs

You have a channel which passes messages. On one end of that channel you set up the message subscriptions. Line 72 builds the subscriptions, setting a handler action for each message type it expects. The HandleOnFiber(_fiber) is forcing all messages to be processed on the same thread and they are queued up as they are received. There are other handle calls and hopefully the API is rather discoverable.

Now this example hides all the channels and fibers in one class, you might have channels connecting different classes in which case a reference to the channel in question would have to be passed around.

Stact is really an Actor library. There aren't any great examples, at the moment, of using it to write actors. I hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文