-
Notifications
You must be signed in to change notification settings - Fork 1
add support for rangeByCompoundKeyPrefix #38
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
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.
Pull Request Overview
This PR adds support for compound key prefix queries in HMap by introducing the rangeByCompoundKeyPrefix method and refactoring the prefix upper bound calculation logic. The changes enable efficient querying of entries grouped by the first component of compound keys (e.g., fetching all users in a namespace).
- Extracted
computePrefixUpperBoundas a reusable helper method for computing lexicographic upper bounds - Added
rangeByCompoundKeyPrefixmethod for querying entries by compound key prefix - Added comprehensive test coverage for both the new functionality and the refactored helper method
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| raft/src/main/scala/zio/raft/HMap.scala | Refactored prefix upper bound calculation into standalone computePrefixUpperBound method; added rangeByCompoundKeyPrefix API with extensive documentation; changed visibility of byteArrayOrdering to private[raft] |
| raft/src/test/scala/zio/raft/HMapRangeByCompoundKeyPrefixSpec.scala | New test suite validating compound key prefix queries with various scenarios including empty second components, unicode characters, and multiple entries |
| raft/src/test/scala/zio/raft/HMapPrefixRangeSpec.scala | Added three new tests for computePrefixUpperBound method covering basic functionality, max byte values, and trailing zero truncation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
raft/src/test/scala/zio/raft/HMapRangeByCompoundKeyPrefixSpec.scala
Outdated
Show resolved
Hide resolved
raft/src/test/scala/zio/raft/HMapRangeByCompoundKeyPrefixSpec.scala
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…scala Co-authored-by: Copilot <[email protected]>
…scala Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
No description provided.