是否有 BufferBlock 的 Filo 实现?
Is there a Filo implementation of a BufferBlock?
我正在将消息推送到 BufferBlock
,然后我想将其路由到两个 BufferBlock 之一。 Primary Block(P)会获取所有的消息,直到Buffer中有一定数量的消息。 P 缓冲区填满后,我想将消息推送到 FILO BufferBlock
(S) 中。然后我想通过 ActionBlock
从这些缓冲区中消费,如果它有消息,优先级在 S 上。
我想我可以弄清楚如何将所有东西组合在一起就好了,但我尝试查看 BufferBlock
在 corefx 中的实现,但我认为我不具备使其成为 FILO 的条件。
TLDR:是否已经有 BufferBlock
的 FILO 实现,或者是否有一种简单(相对)的方法通过修改来自 corefx 的源代码来制作 BufferBlock
FILO?
Is there already an implementation of BufferBlock
that's FILO or is there a simple(relative) way to make the BufferBlock
FILO by modifying its source from corefx
?
不在标准库中。如果你想创建一个新的块,你应该实现基本接口(例如IPropagatorBlock
) or use static method DataflowBlock.Encapsulate
,而不是修改标准块的代码。
您可以在 MSDN 或官方 Introduction to TPL Dataflow.
中找到更多信息
我正在将消息推送到 BufferBlock
,然后我想将其路由到两个 BufferBlock 之一。 Primary Block(P)会获取所有的消息,直到Buffer中有一定数量的消息。 P 缓冲区填满后,我想将消息推送到 FILO BufferBlock
(S) 中。然后我想通过 ActionBlock
从这些缓冲区中消费,如果它有消息,优先级在 S 上。
我想我可以弄清楚如何将所有东西组合在一起就好了,但我尝试查看 BufferBlock
在 corefx 中的实现,但我认为我不具备使其成为 FILO 的条件。
TLDR:是否已经有 BufferBlock
的 FILO 实现,或者是否有一种简单(相对)的方法通过修改来自 corefx 的源代码来制作 BufferBlock
FILO?
Is there already an implementation of
BufferBlock
that's FILO or is there a simple(relative) way to make theBufferBlock
FILO by modifying its source fromcorefx
?
不在标准库中。如果你想创建一个新的块,你应该实现基本接口(例如IPropagatorBlock
) or use static method DataflowBlock.Encapsulate
,而不是修改标准块的代码。
您可以在 MSDN 或官方 Introduction to TPL Dataflow.
中找到更多信息