`Cursor::seek` should return the number of keys skipped over during search
Is your feature request related to a problem? Please describe.
This will help us preallocate the right amount of buffer space in some situations, see e.g., the TODO in window.rs.
Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
No response
FYI We won't be able to get that from the rocksdb cursor
We could make our cursor interface overly general (either by adding extra functions or making it a composition of multiple "bare" cursor traits and extension traits) and then allow consumers to query the current cursor for its capabilities. Since we construct circuits once before running them, this could allow something along these lines:
if CursorType::seek_returns_skipped_keys() {
circuit.add_operator(something_that_uses_skipped_keys());
} else {
circuit.add_operator(some_fallback_implementation());
}
While I'm thinking about it though, seek could probably return a bool that corresponds to Cursor::key_valid() (that is, it returns false if we sought (seeked? sook?) past all valid keys)