-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(kv): define forward cursor interface #16212
Conversation
5dd5ab3
to
e0f7a9b
Compare
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.
Looks great George. I found that that inmem
goroutine for the ForwardCursor
can leak if the consumer does not call Next
to completion.
467f4d3
to
53f307d
Compare
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.
Great improvements – one minor suggestion to simplify the Close logic
53f307d
to
0d7d6d6
Compare
0d7d6d6
to
33bf224
Compare
05b9693
to
d6fcc65
Compare
d6fcc65
to
6632908
Compare
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.
Awesome stuff – this is the beginning to improving the K/V APIs 🏆
* feat(kv): define forward cursor interface * feat(kv): implement ForwardCursor on bolt and inmem buckets * feat(kv): update tests to capture forward cursor * fix(kv): typo in docs * feat(kv): add Err method to ForwardCursor interface * feat(inmem): batch pair channel sends in forward cursor * fix(kv): remove Err field from kv.Pair * feat(kv): add Close to kv.ForwardCursor interface
Closes #5367
This PR introduces the concept for a
ForwardCursor
as described in the issue above. It's purpose is to create a contract in cursor creators declare upfront the direction and start position in which to create a cursor. This will promote healthier access patterns to the existing cursor. Allowing us to optimize a lot easier in the kv bucket implementations.ForwardCursor()
method.