| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T node)
Add node to the consistent hash
|
boolean |
addAll(java.util.Collection<T> nodes)
Add all nodes to the consistent hash
|
boolean |
contains(T node)
Check if consistent hash contains node
|
java.lang.String |
getName()
Return name of the consistent hash instance
|
java.util.Set<T> |
getNodes()
Return list of all nodes that consistent hash contains
|
java.util.Optional<T> |
locate(java.lang.String key)
Find node which most matches the key
|
java.util.Set<T> |
locate(java.lang.String key,
int count)
Find nodes which most matches the key
|
boolean |
remove(T node)
Remove node from the consistent hash
|
int |
size()
Return number of nodes inside consistent hash
|
java.lang.String getName()
boolean add(T node)
node - the node to be addedboolean addAll(java.util.Collection<T> nodes)
nodes - the nodes to be addedboolean contains(T node)
node - the node to be checkedboolean remove(T node)
node - the node to be removedjava.util.Set<T> getNodes()
java.util.Optional<T> locate(java.lang.String key)
key - the keyOptional.empty() if no node was foundjava.util.Set<T> locate(java.lang.String key, int count)
key - the keycount - the amount of nodes to be matchedint size()