Add Jump Consistent Hash implementation with tests#1
Merged
jkyberneees merged 2 commits intomainfrom Sep 4, 2025
Merged
Conversation
Contributor
jkyberneees
commented
Sep 4, 2025
- Updated README to include details on Jump Consistent Hash and its usage.
- Added JumpConsistentHash class with methods for index computation.
- Implemented tests for JumpConsistentHash to validate functionality and edge cases.
- Updated package.json to reflect changes in types and added new files.
- Updated README to include details on Jump Consistent Hash and its usage. - Added JumpConsistentHash class with methods for index computation. - Implemented tests for JumpConsistentHash to validate functionality and edge cases. - Updated package.json to reflect changes in types and added new files.
There was a problem hiding this comment.
Pull Request Overview
Adds Jump Consistent Hash implementation as an alternative to the existing consistent hash ring. This provides a minimal-memory O(1) approach for mapping keys directly to bucket indexes.
- Added JumpConsistentHash class implementing the Lamping & Veach algorithm
- Comprehensive test suite covering functionality and edge cases
- Updated documentation and package configuration to support the new implementation
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updated package metadata to include new Jump Hash files and changed types entry point |
| jump-hash.js | Core Jump Consistent Hash implementation with hash computation and bucket mapping |
| jump-hash.test.js | Complete test suite validating constructor, getIndex method, and distribution properties |
| demos/jump-consistent-hash.js | CommonJS demo showing basic usage |
| demos/jump-consistent-hash.ts | TypeScript demo showing basic usage |
| demos/consistent-hash.ts | TypeScript demo for the existing consistent hash implementation |
| README.md | Updated documentation explaining both implementations with usage examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.