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

Bogdan/generickey #16

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Conversation

fredim
Copy link

@fredim fredim commented Oct 11, 2021

No description provided.

fredim and others added 27 commits January 26, 2016 23:16
added a simple prefix search
single keys with no 0 padding caused index out-of-range
more idiomatic go, to use channels rather than callbacks
one more time, i think mismatch detection is working correctly now
adjusted interface to return the key, since we probably want to know …
Need to handle the case where the search traversal gets you to a leaf
node, but you haven't consumed the whole key. An example is the trivial
case of one string and an empty prefix -- only a leaf node will be
present, and the prefix doesn't consume the string.

To handle this case I had the search helper return the leaf node in this
case, which requires filtering out non-matching leaf nodes in the main
Search method since now searchHelper will return false positives for
prefix-matched leaves.
Was incorrect for the case where you partially match the prefix: this
returns an index > 0 (one or more bytes matched) but less than prefixLen
(not all bytes matched).

Adding a test that failed prefix search before this fix.
As was already fixed for the other, more typical case, in iterating
through the prefix and the key for the first mismatch, need to stop
before exhausting the key and hitting an out-of-bounds crash.
Need to check if test key is exhausted while iterating over full key.
Fix a couple more prefix search issues
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