public interface ConsistentHash
Modifier and Type | Method and Description |
---|---|
List<Address> |
getBackupsForNode(Address node,
int replCount)
Deprecated.
No longer supported. This method doesn't make sense with virtual nodes enabled.
|
Set<Address> |
getCaches()
Should return a collection of cache addresses in the cluster.
|
List<Integer> |
getHashIds(Address a)
Returns a list of values between 0 and the hash space limit, or hash id,
for a particular address.
|
List<Address> |
getStateProvidersOnJoin(Address joiner,
int replCount)
Deprecated.
No longer supported. This method doesn't make sense with virtual nodes enabled.
|
List<Address> |
getStateProvidersOnLeave(Address leaver,
int replCount)
Deprecated.
No longer supported. This method doesn't make sense with virtual nodes enabled.
|
boolean |
isKeyLocalToAddress(Address a,
Object key,
int replCount)
Test to see whether a key is mapped to a given address.
|
List<Address> |
locate(Object key,
int replCount)
Locates a key, given a replication count (number of copies).
|
Map<Object,List<Address>> |
locateAll(Collection<Object> keys,
int replCount)
The logical equivalent of calling
locate(Object, int) multiple times for each key in the collection of
keys. |
Address |
primaryLocation(Object key)
Should be equivalent to return the first element of
locate(Object, int) . |
void |
setCaches(Set<Address> caches)
Sets the collection of cache addresses in the cluster.
|
void setCaches(Set<Address> caches)
caches
- A set of unique caches in cluster.Set<Address> getCaches()
List<Address> locate(Object key, int replCount)
key
- key to locatereplCount
- replication count (number of copies)setCaches(java.util.Set)
. Should never be null, and should contain replCount elements or the max
number of caches available, whichever is smaller.Map<Object,List<Address>> locateAll(Collection<Object> keys, int replCount)
locate(Object, int)
multiple times for each key in the collection of
keys. Implementations may be optimised for such a bulk lookup, or may just repeatedly call locate(Object,
int)
.keys
- keys to locatereplCount
- replication count (number of copies) for each keyboolean isKeyLocalToAddress(Address a, Object key, int replCount)
a
- address to testkey
- key to testreplCount
- repl countList<Integer> getHashIds(Address a)
@Deprecated List<Address> getStateProvidersOnLeave(Address leaver, int replCount)
Pre: leaver must be present in the caches known to this CH, as returned by getCaches()
leaver
- the node that leaves the clusterreplCount
- @Deprecated List<Address> getStateProvidersOnJoin(Address joiner, int replCount)
@Deprecated List<Address> getBackupsForNode(Address node, int replCount)
Address primaryLocation(Object key)
locate(Object, int)
.
Useful as a performance optimization, as this is a frequently needed information.key
- key to locateCopyright © 2012 JBoss by Red Hat. All Rights Reserved.