public class LongToIntConsistentHash extends Object
Modifier and Type | Field and Description |
---|---|
protected TreeMap<Long,Integer> |
circle |
protected static int |
DEFAULT_REPLICAS |
protected int |
numReplicas |
protected int |
replicasInstalledUpTo |
Constructor and Description |
---|
LongToIntConsistentHash() |
LongToIntConsistentHash(int numReplicas) |
Modifier and Type | Method and Description |
---|---|
int |
bucketFor(char[] chars,
int upTo) |
int |
bucketFor(CharSequence cs,
int upTo)
Convenience alternative which creates longHash from CharSequence
|
int |
bucketFor(long longHash,
int upTo)
Return the proper integer bucket-number for the given long hash,
up to the given integer boundary (exclusive).
|
protected long |
hash(CharSequence cs) |
void |
installReplicasUpTo(int upTo)
Install necessary replicas, if not already present.
|
protected long |
replicaLocation(int bucketNumber,
int replicaNumber) |
protected static final int DEFAULT_REPLICAS
protected int replicasInstalledUpTo
protected int numReplicas
public LongToIntConsistentHash()
public LongToIntConsistentHash(int numReplicas)
public void installReplicasUpTo(int upTo)
upTo
- protected long replicaLocation(int bucketNumber, int replicaNumber)
protected long hash(CharSequence cs)
public int bucketFor(long longHash, int upTo)
longHash
- upTo
- public int bucketFor(CharSequence cs, int upTo)
string
- upTo
- public int bucketFor(char[] chars, int upTo)
Copyright © 2003-2014 Internet Archive. All Rights Reserved.