|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvoldemort.routing.StoreRoutingPlan
public class StoreRoutingPlan
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 can be expensive to construct. Invocations of getters should be O(1) if possible. Lazy initialization of cached values is ideal... 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 | |
---|---|
StoreRoutingPlan(Cluster cluster,
StoreDefinition storeDefinition)
|
Method Summary | |
---|---|
boolean |
checkKeyBelongsToNode(byte[] key,
int nodeId)
Determines if the key replicates to the given node |
static boolean |
checkKeyBelongsToNode(byte[] key,
int nodeId,
Cluster cluster,
StoreDefinition storeDef)
|
static java.util.List<java.lang.Integer> |
checkKeyBelongsToPartition(byte[] key,
java.util.Set<Pair<java.lang.Integer,java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>>>> stealerNodeToMappingTuples,
Cluster cluster,
StoreDefinition storeDef)
Given a key and a list of steal infos give back a list of stealer node ids which will steal this. |
static boolean |
checkKeyBelongsToPartition(int nodeId,
byte[] key,
java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> replicaToPartitionList,
Cluster cluster,
StoreDefinition storeDef)
Check that the key belongs to one of the partitions in the map of replica type to partitions |
static boolean |
checkKeyBelongsToPartition(java.util.List<java.lang.Integer> keyPartitions,
java.util.List<java.lang.Integer> nodePartitions,
java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> replicaToPartitionList)
Check that the key belongs to one of the partitions in the map of replica type to partitions |
static boolean |
checkPartitionBelongsToNode(int partition,
int nodeId,
Cluster cluster,
StoreDefinition storeDef)
Checks if a given partition is stored in the node. |
Cluster |
getCluster()
|
int |
getMasterPartitionId(byte[] key)
Determines master partition ID for the key. |
int |
getNodeIdForPartitionId(int partitionId)
Determines node ID that hosts the specified partition ID. |
int |
getNodeIdForZoneNary(int zoneId,
int zoneNary,
int partitionId)
Determines which node hosts partition id with specified n-ary level in specified zone. |
java.lang.Integer |
getNodesPartitionIdForKey(int nodeId,
byte[] key)
Determines the partition ID that replicates the key on the given node. |
java.util.List<java.lang.Integer> |
getReplicatingPartitionList(byte[] key)
Determines list of partition IDs that replicate the key. |
java.util.List<java.lang.Integer> |
getReplicatingPartitionList(int masterPartitionId)
Determines list of partition IDs that replicate the master partition ID. |
java.util.List<java.lang.Integer> |
getReplicationNodeList(int partitionId)
Returns the list of node ids this partition replicates to. |
StoreDefinition |
getStoreDefinition()
|
int |
getZoneNaryForNodesPartition(int zoneId,
int nodeId,
int partitionId)
Determines the zone n-ary replica level of the specified partitionId on the node id in zone id. |
java.util.List<java.lang.Integer> |
getZoneNAryPartitionIds(int nodeId)
Returns all (zone n-ary) partition IDs hosted on the node. |
java.util.List<java.lang.Integer> |
getZonePrimaryPartitionIds(int nodeId)
Returns all zone-primary partition IDs on node. |
boolean |
zoneNAryExists(int zoneId,
int zoneNAry,
int partitionId)
checks if zone has a zone n-ary for partition Id. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StoreRoutingPlan(Cluster cluster, StoreDefinition storeDefinition)
Method Detail |
---|
public Cluster getCluster()
public StoreDefinition getStoreDefinition()
public java.util.List<java.lang.Integer> getReplicatingPartitionList(int masterPartitionId)
masterPartitionId
-
public java.util.List<java.lang.Integer> getReplicatingPartitionList(byte[] key)
key
-
public int getMasterPartitionId(byte[] key)
key
-
public int getNodeIdForPartitionId(int partitionId)
partitionId
-
public java.lang.Integer getNodesPartitionIdForKey(int nodeId, byte[] key)
nodeId
- of the nodekey
- to look up.
public java.util.List<java.lang.Integer> getReplicationNodeList(int partitionId) throws VoldemortException
RoutingStrategy
should house a routeRequest(int
partition) method
partitionId
-
VoldemortException
public java.util.List<java.lang.Integer> getZoneNAryPartitionIds(int nodeId)
nodeId
-
public java.util.List<java.lang.Integer> getZonePrimaryPartitionIds(int nodeId)
nodeId
-
public boolean zoneNAryExists(int zoneId, int zoneNAry, int partitionId)
zoneId
- zoneNAry
- zone n-ary replica to confirmpartitionId
-
public int getZoneNaryForNodesPartition(int zoneId, int nodeId, int partitionId)
zoneId
- nodeId
- partitionId
-
public boolean checkKeyBelongsToNode(byte[] key, int nodeId)
key
- nodeId
-
public static boolean checkKeyBelongsToPartition(java.util.List<java.lang.Integer> keyPartitions, java.util.List<java.lang.Integer> nodePartitions, java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> replicaToPartitionList)
keyPartitions
- Preference list of the keynodePartitions
- Partition list on this nodereplicaToPartitionList
- Mapping of replica type to partition list
public static boolean checkKeyBelongsToPartition(int nodeId, byte[] key, java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>> replicaToPartitionList, Cluster cluster, StoreDefinition storeDef)
nodeId
- Node on which this is running ( generally stealer node )key
- The key to checkreplicaToPartitionList
- Mapping of replica type to partition listcluster
- Cluster metadatastoreDef
- The store definition
public static java.util.List<java.lang.Integer> checkKeyBelongsToPartition(byte[] key, java.util.Set<Pair<java.lang.Integer,java.util.HashMap<java.lang.Integer,java.util.List<java.lang.Integer>>>> stealerNodeToMappingTuples, Cluster cluster, StoreDefinition storeDef)
key
- Byte array of keystealerNodeToMappingTuples
- Pairs of stealer node id to their
corresponding [ partition - replica ] tuplescluster
- Cluster metadatastoreDef
- Store definitions
public static boolean checkPartitionBelongsToNode(int partition, int nodeId, Cluster cluster, StoreDefinition storeDef)
partition
- nodeId
- cluster
- storeDef
-
public static boolean checkKeyBelongsToNode(byte[] key, int nodeId, Cluster cluster, StoreDefinition storeDef)
key
- nodeId
- cluster
- storeDef
-
public int getNodeIdForZoneNary(int zoneId, int zoneNary, int partitionId)
zoneId
- zoneNary
- partitionId
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |