|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.routing.BaseStoreRoutingPlan
public class BaseStoreRoutingPlan
This class wraps up a Cluster object and a StoreDefinition. The methods are effectively helper or util style methods for querying the routing plan that will be generated for a given routing strategy upon store and cluster topology information. This object may be constructed in the fast path (e.g., during proxy'ing) and so this object must be fast/simple to construct. Invocations of getters to find replica lists and n-aries can be O(number of replicas). The intermingling of key-based interfaces and partition-based interfaces is ugly in this class. Partition-based interfaces should be in an underlying class and then key-based interfaces should wrap those up. Or, all of these types of class should implement the getMasterPartition(byte[]) interface from RoutingStrategy. Then the caller always does translation from key to partition ID, and the *StoreRouting* classes only offer partition-based interfaces.
Constructor Summary | |
---|---|
BaseStoreRoutingPlan(Cluster cluster,
StoreDefinition storeDefinition)
|
Method Summary | |
---|---|
Cluster |
getCluster()
|
int |
getMasterPartitionId(byte[] key)
Determines master partition ID for the key. |
int |
getNodeIdForZoneNary(int zoneId,
int zoneNary,
byte[] key)
Given a key and a zoneNary (< zone replication factor), figure out the node that contains the key as the nth replica in the given zone. |
java.util.List<java.lang.Integer> |
getReplicationNodeList(byte[] key)
Determines the list of nodes that the key replicates to |
StoreDefinition |
getStoreDefinition()
|
int |
getZoneNAry(int zoneId,
int nodeId,
byte[] key)
Given a key that belong to a given node, returns a number n (< zone replication factor), such that the given node holds the key as the nth replica of the given zone eg: if the method returns 1, then given node hosts the key as the zone secondary in the given zone |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BaseStoreRoutingPlan(Cluster cluster, StoreDefinition storeDefinition)
Method Detail |
---|
public Cluster getCluster()
public StoreDefinition getStoreDefinition()
public int getMasterPartitionId(byte[] key)
key
-
public int getZoneNAry(int zoneId, int nodeId, byte[] key)
zoneId
- nodeId
- key
-
public int getNodeIdForZoneNary(int zoneId, int zoneNary, byte[] key)
zoneId
- zoneNary
- key
-
public java.util.List<java.lang.Integer> getReplicationNodeList(byte[] key)
key
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |