I have an implementation of System.Collections.Concurrent.Partitioner\ that internally creates a data structure that resembles BlockingCollection<BlockingCollection<T>>, where the inner BlockingCollection<T>'s contain items with the same partition identifier.
When a consumer adds an item, it gets added to an existing BlockingCollection<T> based on the partition identifier or a new BlockingCollection<T> is created if none exists and the item is added to that.
When a BlockingCollection<T> is empty, it's completed and disposed after the last item is consumed & processed. If a new item comes along after completion, as described above, a new BlockingCollection<T> is created and added to BlockingCollection<BlockingCollection<T>>. The purpose is to prevent concurrent processing of items in the same partition id.
I'm trying to make an async version using AsyncCollection but there is no way to know if the collection is empty and therefore I cannot mark it as completed at the appropriate time.
I have an implementation of System.Collections.Concurrent.Partitioner\ that internally creates a data structure that resembles
BlockingCollection<BlockingCollection<T>>
, where the innerBlockingCollection<T>
's contain items with the same partition identifier.When a consumer adds an item, it gets added to an existing
BlockingCollection<T>
based on the partition identifier or a newBlockingCollection<T>
is created if none exists and the item is added to that.When a
BlockingCollection<T>
is empty, it's completed and disposed after the last item is consumed & processed. If a new item comes along after completion, as described above, a newBlockingCollection<T>
is created and added toBlockingCollection<BlockingCollection<T>>
. The purpose is to prevent concurrent processing of items in the same partition id.I'm trying to make an async version using
AsyncCollection
but there is no way to know if the collection is empty and therefore I cannot mark it as completed at the appropriate time.Thanks for the consideration, nice library.