Skip to content

Add Jump Consistent Hash implementation with tests#1

Merged
jkyberneees merged 2 commits intomainfrom
adding-jump-consistent-hash-algorithm
Sep 4, 2025
Merged

Add Jump Consistent Hash implementation with tests#1
jkyberneees merged 2 commits intomainfrom
adding-jump-consistent-hash-algorithm

Conversation

@jkyberneees
Copy link
Copy Markdown
Contributor

  • 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.
@jkyberneees jkyberneees requested a review from Copilot September 4, 2025 18:09

This comment was marked as outdated.

@jkyberneees jkyberneees requested a review from Copilot September 4, 2025 18:11
Copy link
Copy Markdown

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

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.

@jkyberneees jkyberneees merged commit f078b58 into main Sep 4, 2025
2 checks passed
@jkyberneees jkyberneees deleted the adding-jump-consistent-hash-algorithm branch September 4, 2025 19:14
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