|
||||||||||
| 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 |
|---|
groupManager |
| Constructor Summary | |
|---|---|
ExperimentalDefaultConsistentHash()
|
|
| Method Summary | |
|---|---|
boolean |
equals(Object other)
|
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. |
List<Integer> |
getHashIds(Address a)
Returns a list of values between 0 and the hash space limit, or hash id, for a particular address. |
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(Collection<Address> caches)
|
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 |
|---|
getBackupsForNode, getGrouping, getStateProvidersOnJoin, getStateProvidersOnLeave, isKeyLocalToAddress, locateAll, primaryLocation, setGroupManager |
| 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
public void setCaches(Set<Address> caches)
ConsistentHash
caches - A set of unique caches in cluster.public void setCaches(Collection<Address> caches)
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 List<Integer> getHashIds(Address a)
ConsistentHash
public String toString()
toString in class AbstractConsistentHashpublic boolean equals(Object other)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
--> | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||