voldemort.routing
Class RouteToAllStrategy

java.lang.Object
  extended by voldemort.routing.RouteToAllStrategy
All Implemented Interfaces:
RoutingStrategy
Direct Known Subclasses:
RouteToAllLocalPrefStrategy

public class RouteToAllStrategy
extends java.lang.Object
implements RoutingStrategy

A routing strategy which just routes each request to all the nodes given. Pretend that there is one partition ID "0" that all keys map to and that is replicated on all nodes.


Constructor Summary
RouteToAllStrategy(java.util.Collection<Node> nodes)
           
 
Method Summary
 java.lang.Integer getMasterPartition(byte[] key)
          Obtain the master partition for a given key
 java.util.Set<Node> getNodes()
          Get the collection of nodes that are candidates for routing.
 int getNumReplicas()
          Return the number of replicas
 java.util.List<java.lang.Integer> getPartitionList(byte[] key)
          Get the partition list for the given key.
 java.util.List<java.lang.Integer> getReplicatingPartitionList(int partitionId)
          Get the replication partitions list for the given partition.
 java.lang.String getType()
          Get the type of RoutingStrategyType
 java.util.List<Node> routeRequest(byte[] key)
          Get the node preference list for the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RouteToAllStrategy

public RouteToAllStrategy(java.util.Collection<Node> nodes)
Method Detail

getNumReplicas

public int getNumReplicas()
Description copied from interface: RoutingStrategy
Return the number of replicas

Specified by:
getNumReplicas in interface RoutingStrategy
Returns:
The number of replicas

routeRequest

public java.util.List<Node> routeRequest(byte[] key)
Description copied from interface: RoutingStrategy
Get the node preference list for the given key. The preference list is a list of nodes to perform an operation on.

Specified by:
routeRequest in interface RoutingStrategy
Parameters:
key - The key the operation is operating on
Returns:
The preference list for the given key

getNodes

public java.util.Set<Node> getNodes()
Description copied from interface: RoutingStrategy
Get the collection of nodes that are candidates for routing.

Specified by:
getNodes in interface RoutingStrategy
Returns:
The collection of nodes

getPartitionList

public java.util.List<java.lang.Integer> getPartitionList(byte[] key)
Description copied from interface: RoutingStrategy
Get the partition list for the given key. TODO: The naming of this method is confusing.. it is simply a wrapper around RoutingStrategy.getReplicatingPartitionList(int) that takes a key. So, would be good to rename this also as getReplicatingPartitionList

Specified by:
getPartitionList in interface RoutingStrategy
Parameters:
key - The key the operation is operating on
Returns:
The partition list for the given key

getReplicatingPartitionList

public java.util.List<java.lang.Integer> getReplicatingPartitionList(int partitionId)
Description copied from interface: RoutingStrategy
Get the replication partitions list for the given partition.

Specified by:
getReplicatingPartitionList in interface RoutingStrategy
Returns:
The List of partitionId where this partition is replicated.

getMasterPartition

public java.lang.Integer getMasterPartition(byte[] key)
Obtain the master partition for a given key

Specified by:
getMasterPartition in interface RoutingStrategy
Parameters:
key -
Returns:
master partition id

getType

public java.lang.String getType()
Description copied from interface: RoutingStrategy
Get the type of RoutingStrategyType

Specified by:
getType in interface RoutingStrategy
Returns:
RoutingStrategyType


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu