Skip to main content

walk_cursor

Function walk_cursor 

Source
fn walk_cursor<C, F>(
    cursor: &mut C,
    batch: &C::Storage,
    key: Option<&C::Key<'_>>,
    fuel: &mut usize,
    emit: F,
)
where C: Cursor<KeyContainer: BatchContainer<Owned: PartialEq + Sized>>, F: FnMut(C::Key<'_>, C::Val<'_>, C::Time, C::Diff) -> usize,
Expand description

Walk a cursor, calling emit for each consolidated (key, val, time, diff) tuple. If key is set, the cursor is seeked to it and only values for that key are produced.

emit returns the number of records it produced for the given input tuple. The cursor stops as soon as the accumulated emit count reaches *fuel, leaving the cursor in place so work can resume on a later call. Within a batch, both the inner val loop and the outer key loop are bounded only by emit count, so selective filters (emit returns 0) run to batch completion in a single activation — see ArrangementFlavor::flat_map for why fuel counts output rather than input.