示例#1
0
文件: tests.py 项目: tkaemming/dht
def test_rehashing():
    """
    Tests key rehashing for replication.
    """
    count = 3
    rehashed = rehash('example', count)
    assert len(rehashed) == count
    assert len(set(rehashed)) == count
示例#2
0
 def rehash(self, key):
     return map(lambda hash: '%s:%s' % (key, hash),
         rehash(key, self.replica_count))