Skip to content
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

Adds Seek and Prev to Iterator interface #11

Merged
merged 1 commit into from
Dec 8, 2021
Merged

Adds Seek and Prev to Iterator interface #11

merged 1 commit into from
Dec 8, 2021

Conversation

bbengfort
Copy link
Contributor

Although primarily a leveldb iterator interface, having Prev in addition
to Next is going to be a helpful utility if we can implement it with
other engines. The larger requirement is Seek which is absolutely needed
for pagination and other advanced iteration. These are primarily a
passthrough for leveldb operations, but I've also added some tests for
the empty iterator which is not a passthrough.

Although primarily a leveldb iterator interface, having Prev in addition
to Next is going to be a helpful utility if we can implement it with
other engines. The larger requirement is Seek which is absolutely needed
for pagination and other advanced iteration. These are primarily a
passthrough for leveldb operations, but I've also added some tests for
the empty iterator which is not a passthrough.
@bbengfort bbengfort requested a review from pdeziel December 8, 2021 02:47
@codecov
Copy link

codecov bot commented Dec 8, 2021

Codecov Report

Merging #11 (31a6db3) into main (f871cd3) will increase coverage by 2.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   44.10%   46.22%   +2.11%     
==========================================
  Files           6        7       +1     
  Lines         331      344      +13     
==========================================
+ Hits          146      159      +13     
  Misses        155      155              
  Partials       30       30              
Impacted Files Coverage Δ
iterator/empty.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f871cd3...31a6db3. Read the comment docs.

Copy link
Contributor

@pdeziel pdeziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!


// Seek moves the iterator to the first key/value pair whose key is greater than or
// equal to the given key. It returns whether such pair exists.
Seek(key []byte) bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like this is equivalent to pebble's SeekGE.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a relief - I'm hoping Badger also has something similar!

@bbengfort bbengfort merged commit cc7d202 into main Dec 8, 2021
@bbengfort bbengfort deleted the iter-seek branch December 8, 2021 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants