pub struct MultiIteratorScanner<'a, T, U, F>where
F: FnMut(&T, &mut U) -> ProcessingDecision,{ /* private fields */ }Expand description
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.
Example:
Assume transactions with same letter conflict with each other. A typical priority ordered buffer might look like:
[A, A, B, A, C, D, B, C, D]
If we want to have batches of size 4, the MultiIteratorScanner will proceed as follows:
[A, A, B, A, C, D, B, C, D]
^ ^ ^ ^
[A, A, B, A, C, D, B, C, D]
^ ^ ^ ^
[A, A, B, A, C, D, B, C, D]
^
The iterator will iterate with batches:
[[A, B, C, D], [A, B, C, D], [A]]
Implementations§
source§impl<'a, T, U, F> MultiIteratorScanner<'a, T, U, F>where
F: FnMut(&T, &mut U) -> ProcessingDecision,
impl<'a, T, U, F> MultiIteratorScanner<'a, T, U, F>where F: FnMut(&T, &mut U) -> ProcessingDecision,
pub fn new( slice: &'a [T], max_iterators: usize, payload: U, should_process: F ) -> Self
sourcepub fn iterate(&mut self) -> Option<(&[&'a T], &mut U)>
pub fn iterate(&mut self) -> Option<(&[&'a T], &mut U)>
Returns a slice of the item references at the current positions of the iterators and a mutable reference to the payload.
Returns None if the scanner is done iterating.
sourcepub fn finalize(self) -> PayloadAndAlreadyHandled<U>
pub fn finalize(self) -> PayloadAndAlreadyHandled<U>
Consume the iterator. Return the payload, and a vector of booleans indicating which items have been handled.
Auto Trait Implementations§
impl<'a, T, U, F> RefUnwindSafe for MultiIteratorScanner<'a, T, U, F>where F: RefUnwindSafe, T: RefUnwindSafe, U: RefUnwindSafe,
impl<'a, T, U, F> Send for MultiIteratorScanner<'a, T, U, F>where F: Send, T: Sync, U: Send,
impl<'a, T, U, F> Sync for MultiIteratorScanner<'a, T, U, F>where F: Sync, T: Sync, U: Sync,
impl<'a, T, U, F> Unpin for MultiIteratorScanner<'a, T, U, F>where F: Unpin, U: Unpin,
impl<'a, T, U, F> UnwindSafe for MultiIteratorScanner<'a, T, U, F>where F: UnwindSafe, T: RefUnwindSafe, U: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Requestsource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request