{"id":13412530,"url":"https://github.com/edwingeng/doublejump","last_synced_at":"2026-01-16T21:50:54.874Z","repository":{"id":57481192,"uuid":"138761836","full_name":"edwingeng/doublejump","owner":"edwingeng","description":"A revamped Google's jump consistent hash","archived":false,"fork":false,"pushed_at":"2022-10-19T16:34:25.000Z","size":38,"stargazers_count":107,"open_issues_count":0,"forks_count":16,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-13T17:43:50.393Z","etag":null,"topics":["consistent-hash","consistent-hash-algorithm","consistent-hashing","consistent-hashing-library","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edwingeng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-26T16:04:50.000Z","updated_at":"2025-07-16T06:51:24.000Z","dependencies_parsed_at":"2023-01-20T07:01:00.631Z","dependency_job_id":null,"html_url":"https://github.com/edwingeng/doublejump","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/edwingeng/doublejump","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fdoublejump","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fdoublejump/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fdoublejump/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fdoublejump/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edwingeng","download_url":"https://codeload.github.com/edwingeng/doublejump/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edwingeng%2Fdoublejump/sbom","scorecard":{"id":367621,"data":{"date":"2025-08-11","repo":{"name":"github.com/edwingeng/doublejump","commit":"9a3654919fcb54b396f0a35b1afafdd237f45c52"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T12:14:20.017Z","repository_id":57481192,"created_at":"2025-08-18T12:14:20.017Z","updated_at":"2025-08-18T12:14:20.017Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28483939,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["consistent-hash","consistent-hash-algorithm","consistent-hashing","consistent-hashing-library","golang"],"created_at":"2024-07-30T20:01:25.779Z","updated_at":"2026-01-16T21:50:54.840Z","avatar_url":"https://github.com/edwingeng.png","language":"Go","readme":"# Overview\nDoublejump is a revamped [Google's jump](https://arxiv.org/pdf/1406.2294.pdf) consistent hash. It overcomes the shortcoming of the original design - being unable to remove nodes. Here is [how it works](https://docs.google.com/presentation/d/e/2PACX-1vTHyFGUJ5CBYxZTzToc_VKxP_Za85AeZqQMNGLXFLP1tX0f9IF_z3ys9-pyKf-Jj3iWpm7dUDDaoFyb/pub?start=false\u0026loop=false\u0026delayms=3000).\n\n# Benchmark\n```\nDoublejump/10-nodes               49276861       22.3 ns/op        0 B/op      0 allocs/op\nDoublejump/100-nodes              33304191       34.9 ns/op        0 B/op      0 allocs/op\nDoublejump/1000-nodes             25261296       46.3 ns/op        0 B/op      0 allocs/op\n\nStathatConsistent/10-nodes         4780832      273.5 ns/op       80 B/op      2 allocs/op\nStathatConsistent/100-nodes        4059537      291.8 ns/op       80 B/op      2 allocs/op\nStathatConsistent/1000-nodes       3132294      367.6 ns/op       80 B/op      2 allocs/op\n\nSerialxHashring/10-nodes           2766384      455.7 ns/op      152 B/op      5 allocs/op\nSerialxHashring/100-nodes          2500936      487.6 ns/op      152 B/op      5 allocs/op\nSerialxHashring/1000-nodes         2254138      560.0 ns/op      152 B/op      5 allocs/op\n```\n\n# Getting Started\n\n### V1\n```shell\n## If golang version \u003c= 1.17\ngo get -u github.com/edwingeng/doublejump\n```\n\n### V2\n```shell\n## If golang version \u003e= 1.18\ngo get -u github.com/edwingeng/doublejump/v2\n```\n\n# Examples\n\n### V1\n```go\n// If golang version \u003c= 1.17\nimport \"github.com/edwingeng/doublejump\"\n\nfunc Example() {\n    h := NewHash()\n    for i := 0; i \u003c 10; i++ {\n        h.Add(fmt.Sprintf(\"node%d\", i))\n    }\n\n    fmt.Println(h.Len())\n    fmt.Println(h.LooseLen())\n\n    fmt.Println(h.Get(1000))\n    fmt.Println(h.Get(2000))\n    fmt.Println(h.Get(3000))\n\n    h.Remove(\"node3\")\n    fmt.Println(h.Len())\n    fmt.Println(h.LooseLen())\n\n    fmt.Println(h.Get(1000))\n    fmt.Println(h.Get(2000))\n    fmt.Println(h.Get(3000))\n\n    // Output:\n    // 10\n    // 10\n    // node9\n    // node2\n    // node3\n    // 9\n    // 10\n    // node9\n    // node2\n    // node0\n}\n```\n\n### V2\n```go\n// If golang version \u003e= 1.18\nimport \"github.com/edwingeng/doublejump/v2\"\n\nfunc Example() {\n    h := NewHash[string]()\n    for i := 0; i \u003c 10; i++ {\n        h.Add(fmt.Sprintf(\"node%d\", i))\n    }\n\n    fmt.Println(h.Len())\n    fmt.Println(h.LooseLen())\n\n    fmt.Println(h.Get(1000))\n    fmt.Println(h.Get(2000))\n    fmt.Println(h.Get(3000))\n\n    h.Remove(\"node3\")\n    fmt.Println(h.Len())\n    fmt.Println(h.LooseLen())\n\n    fmt.Println(h.Get(1000))\n    fmt.Println(h.Get(2000))\n    fmt.Println(h.Get(3000))\n\n    // Output:\n    // 10\n    // 10\n    // node9 true\n    // node2 true\n    // node3 true\n    // 9\n    // 10\n    // node9 true\n    // node2 true\n    // node0 true\n}\n```\n\n# Acknowledgements\nThe implementation of the original algorithm is credited to [dgryski](https://github.com/dgryski/go-jump).\n","funding_links":[],"categories":["分布式系统","Distributed Systems","Relational Databases","Go"],"sub_categories":["检索及分析资料库","Search and Analytic Databases","Advanced Console UIs","SQL 查询语句构建库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwingeng%2Fdoublejump","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedwingeng%2Fdoublejump","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedwingeng%2Fdoublejump/lists"}