|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.distribution.ch.AbstractConsistentHash
org.infinispan.distribution.ch.ExperimentalDefaultConsistentHash
public class ExperimentalDefaultConsistentHash
Consistent hashing algorithm. Each target is entered into the pool weight[i]*weightFactor times. Where weight[i] and weightFactor are integers greater than zero.
Based on akluge's impl on http://www.vizitsolutions.com/ConsistentHashingCaching.html
Nested Class Summary | |
---|---|
static class |
ExperimentalDefaultConsistentHash.Entry
An entry into a consistent hash. |
static class |
ExperimentalDefaultConsistentHash.Externalizer
|
Field Summary |
---|
Fields inherited from class org.infinispan.distribution.ch.AbstractConsistentHash |
---|
caches |
Constructor Summary | |
---|---|
ExperimentalDefaultConsistentHash()
|
Method Summary | |
---|---|
boolean |
equals(Object other)
|
List<Address> |
getBackupsForNode(Address node,
int replCount)
Returns the nodes that backup data for the supplied node including the node itself. |
Set<Address> |
getCaches()
Should return a collection of cache addresses in the cluster. |
int |
getDistance(Address a1,
Address a2)
The distance between the first entries in the address array for two caches, a1 and a2. |
int |
getHashId(Address a)
Returns the value between 0 and the hash space limit, or hash id, for a particular address. |
int |
getHashSpace()
Returns the hash space constant for this consistent hash algorithm class. |
List<Address> |
getStateProvidersOnJoin(Address joiner,
int replCount)
Returns the nodes that would act as state providers when a new node joins: - the nodes for which the joiner is a backup - the nodes that held joiner's state |
List<Address> |
getStateProvidersOnLeave(Address leaver,
int replCount)
Returns the nodes that need will replicate their state if the specified node crashes. |
int |
hashCode()
|
boolean |
isAdjacent(Address a1,
Address a2)
Two hashes are adjacent if they are next to each other in the consistent hash. |
List<Address> |
locate(Object key,
int replCount)
Locates a key, given a replication count (number of copies). |
void |
setCaches(Set<Address> caches)
Sets the collection of cache addresses in the cluster. |
String |
toString()
|
Methods inherited from class org.infinispan.distribution.ch.AbstractConsistentHash |
---|
isKeyLocalToAddress, locateAll, setTopologyInfo |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ExperimentalDefaultConsistentHash()
Method Detail |
---|
public Set<Address> getCaches()
ConsistentHash
getCaches
in interface ConsistentHash
getCaches
in class AbstractConsistentHash
public void setCaches(Set<Address> caches)
ConsistentHash
setCaches
in interface ConsistentHash
setCaches
in class AbstractConsistentHash
caches
- A set of unique caches in cluster.public int getDistance(Address a1, Address a2)
a1
- The address of the first cache.a2
- The address of the second cache.
public boolean isAdjacent(Address a1, Address a2)
a1
- The address of the first cache.a2
- The address of the second cache.
public List<Address> locate(Object key, int replCount)
ConsistentHash
key
- key to locatereplCount
- replication count (number of copies)
ConsistentHash.setCaches(java.util.Set)
. Should never be null, and should contain replCount elements or the max
number of caches available, whichever is smaller.public int getHashId(Address a)
ConsistentHash
public int getHashSpace()
ConsistentHash
public String toString()
toString
in class AbstractConsistentHash
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
public List<Address> getStateProvidersOnLeave(Address leaver, int replCount)
ConsistentHash
Pre: leaver must be present in the caches known to this CH, as returned by ConsistentHash.getCaches()
leaver
- the node that leaves the clusterpublic List<Address> getStateProvidersOnJoin(Address joiner, int replCount)
ConsistentHash
public List<Address> getBackupsForNode(Address node, int replCount)
ConsistentHash
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |