org.elasticsearch.cluster.routing
Class RoutingTable

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

public class RoutingTable
extends Object
implements Iterable<IndexRoutingTable>


Nested Class Summary
static class RoutingTable.Builder
           
 
Field Summary
static RoutingTable EMPTY_ROUTING_TABLE
           
 
Method Summary
 GroupShardsIterator activePrimaryShardsGrouped(String[] indices, boolean includeEmpty)
          All the *active* primary shards for the provided indices grouped (each group is a single element, consisting of the primary shard).
 GroupShardsIterator allActiveShardsGrouped(String[] indices, boolean includeEmpty)
           
 GroupShardsIterator allAssignedShardsGrouped(String[] indices, boolean includeEmpty)
           
 List<ShardRouting> allShards(String... indices)
          All the shards (replicas) for the provided indices.
 GroupShardsIterator allShardsGrouped(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()
           
 Map<String,IndexRoutingTable> getIndicesRouting()
           
 boolean hasIndex(String index)
           
 IndexRoutingTable index(String index)
           
 Map<String,IndexRoutingTable> indicesRouting()
           
 com.google.common.collect.UnmodifiableIterator<IndexRoutingTable> iterator()
           
 String prettyPrint()
           
 RoutingNodes routingNodes(ClusterState state)
           
 List<ShardRouting> shardsWithState(ShardRoutingState... states)
           
 RoutingTableValidation validate(MetaData metaData)
           
 RoutingTable validateRaiseException(MetaData metaData)
           
 long version()
           
 
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

version

public long version()

iterator

public com.google.common.collect.UnmodifiableIterator<IndexRoutingTable> iterator()
Specified by:
iterator in interface Iterable<IndexRoutingTable>

hasIndex

public boolean hasIndex(String index)

index

public IndexRoutingTable index(String index)

indicesRouting

public Map<String,IndexRoutingTable> indicesRouting()

getIndicesRouting

public Map<String,IndexRoutingTable> getIndicesRouting()

routingNodes

public RoutingNodes routingNodes(ClusterState state)

validateRaiseException

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

validate

public RoutingTableValidation validate(MetaData metaData)

shardsWithState

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

allShards

public List<ShardRouting> allShards(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(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()

allActiveShardsGrouped

public GroupShardsIterator allActiveShardsGrouped(String[] indices,
                                                  boolean includeEmpty)
                                           throws IndexMissingException
Throws:
IndexMissingException

allAssignedShardsGrouped

public GroupShardsIterator allAssignedShardsGrouped(String[] indices,
                                                    boolean includeEmpty)
                                             throws IndexMissingException
Throws:
IndexMissingException

activePrimaryShardsGrouped

public GroupShardsIterator activePrimaryShardsGrouped(String[] indices,
                                                      boolean includeEmpty)
                                               throws IndexMissingException
All the *active* 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()

prettyPrint

public String prettyPrint()


Copyright © 2009-2012. All Rights Reserved.