feat(pageserver): add iterator API for btree reader #8083
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The new image iterator and delta iterator uses an iterator-based API. #8006 / part of #8002
This requires the underlying thing (the btree) to have an iterator API, and the iterator should have a type name so that it can be stored somewhere.
versus
(this requires nightly flag and still buggy in the Rust compiler)
There are multiple ways to achieve this:
async next
. This is the most efficient way to do that.get_stream
API, which is the current approach in the pull request.In the future, we should do (1), and the
get_stream
API should be refactored to use the iterator API. With (2), we have to wrap theget_stream
API withPin<Box<dyn Stream>>
, where we have the overhead of dynamic dispatch. However, (2) needs a rewrite of thevisit
function, which would take some time to write and review. I'd like to define this iterator API first and work on a real iterator API later.Summary of changes
Add
DiskBtreeIterator
and related tests.Checklist before requesting a review
Checklist before merging