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

bucket,cursor: clarify sort order and seek algorithm #250

Merged
merged 1 commit into from
Dec 21, 2022
Merged

bucket,cursor: clarify sort order and seek algorithm #250

merged 1 commit into from
Dec 21, 2022

Conversation

x1ddos
Copy link
Contributor

@x1ddos x1ddos commented Oct 22, 2020

The sort order isn't mentioned anywhere except one sentence in the readme. So is seek. Although it can be inferred from B+tree and other hints, it is important to be able to confirm from just reading doc comments. So, make it explicit.

cursor.go Outdated
@@ -110,7 +111,7 @@ func (c *Cursor) Prev() (key []byte, value []byte) {
return k, v
}

// Seek moves the cursor to a given key and returns it.
// Seek moves the cursor to a given key using a binary search and returns it.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I would call it "b-tree search" (binary search is only within a single page)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The sort order isn't mentioned anywhere except one sentence in the
readme. So is seek. Although it can be inferred from B+tree and other
hints, it is important to be able to confirm from just reading doc
comments. So, make it explicit.
@ptabor ptabor merged commit 4b8c533 into etcd-io:master Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants