Expand description

Provides an iterator interface that create non-conflicting batches of elements to process.

The problem that this structure is targetting is as following: We have a slice of transactions we want to process in batches where transactions in the same batch do not conflict with each other. This allows us process them in parallel. The original slice is ordered by priority, and it is often the case that transactions with high-priority are conflicting with each other. This means we cannot simply grab chunks of transactions. The solution is to create a MultiIteratorScanner that will use multiple iterators, up to the desired batch size, and create batches of transactions that do not conflict with each other. The MultiIteratorScanner stores state for the current positions of each iterator, as well as which transactions have already been handled. If a transaction is invalid it can also be skipped without being considered for future batches.

Structs

Iterates over a slice creating valid non-self-conflicting batches of elements to process, elements between batches are not guaranteed to be non-conflicting. Conflicting elements are guaranteed to be processed in the order they appear in the slice, as long as the should_process function is appropriately marking resources as used. It is also guaranteed that elements within the batch are in the order they appear in the slice. The batch size is not guaranteed to be max_iterators - it can be smaller.

Enums

Output from the element checker used in MultiIteratorScanner::iterate.