Package com.yahoo.search.cluster
Class Hasher<T>
- java.lang.Object
-
- com.yahoo.search.cluster.Hasher<T>
-
public class Hasher<T> extends Object
A hasher load balances between a set of nodes, represented by object ids.- Author:
- Arne B Fossaa, bratseth, Prashanth B. Bhat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Hasher.NodeFactor<T>
static class
Hasher.NodeList<T>
-
Constructor Summary
Constructors Constructor Description Hasher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T node)
Adds a node with load factor 100void
add(T node, int load)
Adds a code with a load factor.Hasher.NodeList<T>
getNodes()
Returns a list of nodes that are up.void
remove(T node)
Removes a node
-
-
-
Method Detail
-
add
public void add(T node)
Adds a node with load factor 100
-
add
public void add(T node, int load)
Adds a code with a load factor. The load factor is relative to the load of the other added nodes and determines how often this node will be selected compared to the other nodes
-
remove
public void remove(T node)
Removes a node
-
getNodes
public Hasher.NodeList<T> getNodes()
Returns a list of nodes that are up.
-
-