-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor btree iterator last index #125
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly, I believe I there is still an issue. If we have a value >= ORDER
in the LastIndex::At
value, the following line will fail because there are only ORDER
separators:
Line 430 in 3e988a7
if let Some(address) = state.1.separator_address(at) { |
(I discovered this problem while fuzzing this change)
Thank you, I also see other issue with seek, I will fix this. |
I ended up refactoring (see updated description) a bit but should be a good thing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the update!
I have fuzzed it during 1/2h and it seems to work properly now.
After working on #124.
I did realize many variants of LastIndex were useless.
This PR changes:
LastIndex::Start -> LastIndex::Before(0)
LastIndex::End -> LastIndex::Before(last separator + 1) . (so can be equal to ORDER).
LastIndex::After(i) -> LastIndex::Before(i + 1)
Also a seek operation do not need a direction.
And seek_to_last is now using a variant of SeekTo enum.
Close #124