Skip to main content

Module reverse

Module reverse 

Source
Expand description

Descending k-way merge - the backward half of a cursor. Sources must be sorted DESCENDING; output is the global descending union.

A freshly built ReverseMergeIterator sits on the largest value across every source, which is the position RocksDB calls SeekToLast. seek_for_prev(target) moves it to the largest value <= target, and set_lower_bound(lo) stops the walk at lo inclusive, matching RocksDB’s iterate_lower_bound.

What this is NOT is a bidirectional cursor. RocksDB’s Prev() can reverse mid-scan because each child is a seekable file cursor; the sources here are one-shot iterators that only move forward through their own order, so a direction flip would have to re-read them. Pick the direction when you open the merge.

Structs§

ReverseMergeIterator