org.elasticsearch.cluster.routing
Class RoutingTable

java.lang.Object
  extended by org.elasticsearch.cluster.routing.RoutingTable
All Implemented Interfaces:
java.lang.Iterable<IndexRoutingTable>

@Immutable
public class RoutingTable
extends java.lang.Object
implements java.lang.Iterable<IndexRoutingTable>


Nested Class Summary
static class RoutingTable.Builder
           
 
Field Summary
static RoutingTable EMPTY_ROUTING_TABLE
           
 
Method Summary
 java.util.List<ShardRouting> allShards(java.lang.String... indices)
          All the shards (replicas) for the provided indices.
 GroupShardsIterator allShardsGrouped(java.lang.String... indices)
          All the shards (primary + replicas) for the provided indices grouped (each group is a single element, consisting of the shard).
static RoutingTable.Builder builder()
           
 java.util.Map<java.lang.String,IndexRoutingTable> getIndicesRouting()
           
 boolean hasIndex(java.lang.String index)
           
 IndexRoutingTable index(java.lang.String index)
           
 java.util.Map<java.lang.String,IndexRoutingTable> indicesRouting()
           
 org.elasticsearch.common.collect.UnmodifiableIterator<IndexRoutingTable> iterator()
           
static RoutingTable.Builder newRoutingTableBuilder()
           
 java.lang.String prettyPrint()
           
 GroupShardsIterator primaryShardsGrouped(java.lang.String... indices)
          All the primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard).
 RoutingNodes routingNodes(ClusterState state)
           
 RoutingNodes routingNodes(MetaData metaData, ClusterBlocks blocks)
           
 java.util.List<ShardRouting> shardsWithState(ShardRoutingState... states)
           
 RoutingTableValidation validate(MetaData metaData)
           
 RoutingTable validateRaiseException(MetaData metaData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ROUTING_TABLE

public static final RoutingTable EMPTY_ROUTING_TABLE
Method Detail

iterator

public org.elasticsearch.common.collect.UnmodifiableIterator<IndexRoutingTable> iterator()
Specified by:
iterator in interface java.lang.Iterable<IndexRoutingTable>

hasIndex

public boolean hasIndex(java.lang.String index)

index

public IndexRoutingTable index(java.lang.String index)

indicesRouting

public java.util.Map<java.lang.String,IndexRoutingTable> indicesRouting()

getIndicesRouting

public java.util.Map<java.lang.String,IndexRoutingTable> getIndicesRouting()

routingNodes

public RoutingNodes routingNodes(ClusterState state)

routingNodes

public RoutingNodes routingNodes(MetaData metaData,
                                 ClusterBlocks blocks)

validateRaiseException

public RoutingTable validateRaiseException(MetaData metaData)
                                    throws RoutingValidationException
Throws:
RoutingValidationException

validate

public RoutingTableValidation validate(MetaData metaData)

shardsWithState

public java.util.List<ShardRouting> shardsWithState(ShardRoutingState... states)

allShards

public java.util.List<ShardRouting> allShards(java.lang.String... indices)
                                       throws IndexMissingException
All the shards (replicas) for the provided indices.

Parameters:
indices - The indices to return all the shards (replicas), can be null or empty array to indicate all indices
Returns:
All the shards matching the specific index
Throws:
IndexMissingException - If an index passed does not exists

allShardsGrouped

public GroupShardsIterator allShardsGrouped(java.lang.String... indices)
                                     throws IndexMissingException
All the shards (primary + replicas) for the provided indices grouped (each group is a single element, consisting of the shard). This is handy for components that expect to get group iterators, but still want in some cases to iterate over all the shards (and not just one shard in replication group).

Parameters:
indices - The indices to return all the shards (replicas), can be null or empty array to indicate all indices
Returns:
All the shards grouped into a single shard element group each
Throws:
IndexMissingException - If an index passed does not exists
See Also:
IndexRoutingTable.groupByAllIt()

primaryShardsGrouped

public GroupShardsIterator primaryShardsGrouped(java.lang.String... indices)
                                         throws IndexMissingException
All the primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard). This is handy for components that expect to get group iterators, but still want in some cases to iterate over all primary shards (and not just one shard in replication group).

Parameters:
indices - The indices to return all the shards (replicas), can be null or empty array to indicate all indices
Returns:
All the primary shards grouped into a single shard element group each
Throws:
IndexMissingException - If an index passed does not exists
See Also:
IndexRoutingTable.groupByAllIt()

builder

public static RoutingTable.Builder builder()

newRoutingTableBuilder

public static RoutingTable.Builder newRoutingTableBuilder()

prettyPrint

public java.lang.String prettyPrint()