Skip to content

Conversation

@somdoron
Copy link
Contributor

@somdoron somdoron commented Nov 9, 2025

No description provided.

@somdoron somdoron requested a review from Copilot November 9, 2025 12:19
Copy link
Contributor

Copilot AI left a 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 computePrefixUpperBound as a reusable helper method for computing lexicographic upper bounds
  • Added rangeByCompoundKeyPrefix method 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.

@keisar keisar merged commit 5aac189 into unit-finance:main Nov 10, 2025
1 of 2 checks passed
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