Skip to content

minkikim89/libconsistent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libconsistent

C library for various types of consistent hashing

Support consistent hashing algorithms

  • consistent hashing
  • ketama consistent hashing
  • jump consistent hashing

How to install

Copy libconsistent.c, libconsistent.h files and compile with your project.

Usage

consistent hashing

cons_hash *cons = chash_create();
chash_add_server(cons, "1.1.1.1:1111");
server_info *chash_server = chash_get_server(cons, "test_key");
chash_del_server(cons, chash_server);

ketama consistent hashing

ketama_hash *ketama = ketama_create();
ketama_add_server(ketama, "1.1.1.1:1111");
server_info *ketama_server = ketama_get_server(ketama, "test_key");
ketama_del_server(ketama, ketama_server);

jump consistent hashing

jump_hash *jump = jump_create();
jump_add_server(jump, "1.1.1.1:1111");
server_info *jump_server = jump_get_server(jump, "test_key");
// jump hashing doesn't support jump_del_server api

reference

About

C library for various types of consistent hashing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published