This library is a thin python wrapper around hash ring implementation in https://github.com/chrismoos/hash-ring
pyhashring can be installed via pypi:
pip install pyhashring
Get the source:
git clone https://github.com/blackwithwhite666/pyhashring.git
Compile extension:
python setup.py build_ext --inplace
Get node by key:
from pyhashring import HashRing
h = HashRing()
h.add(b'SlotA')
h.add(b'SlotB')
h.find('keyA')
>>> 'SlotB'
h.find('keyB')
>>> 'SlotA'
Use Tox to run the test suite:
tox