public class RoutingTable extends java.lang.Object implements java.lang.Iterable<IndexRoutingTable>, Diffable<RoutingTable>
IndexRoutingTable| Modifier and Type | Class and Description |
|---|---|
static class |
RoutingTable.Builder
Builder for the routing table.
|
Writeable.Reader<V>, Writeable.Writer<V>| Modifier and Type | Field and Description |
|---|---|
static RoutingTable |
EMPTY_ROUTING_TABLE |
| Modifier and Type | Method and Description |
|---|---|
GroupShardsIterator<ShardIterator> |
activePrimaryShardsGrouped(java.lang.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(java.lang.String[] indices,
boolean includeEmpty) |
GroupShardsIterator |
allActiveShardsGrouped(java.lang.String[] indices,
boolean includeEmpty,
boolean includeRelocationTargets)
Return GroupShardsIterator where each active shard routing has it's own shard iterator.
|
GroupShardsIterator<ShardIterator> |
allAssignedShardsGrouped(java.lang.String[] indices,
boolean includeEmpty) |
GroupShardsIterator<ShardIterator> |
allAssignedShardsGrouped(java.lang.String[] indices,
boolean includeEmpty,
boolean includeRelocationTargets)
Return GroupShardsIterator where each assigned shard routing has it's own shard iterator.
|
java.util.List<ShardRouting> |
allShards()
All the shards (replicas) for all indices in this routing table.
|
java.util.List<ShardRouting> |
allShards(java.lang.String index)
All the shards (replicas) for the provided index.
|
ShardsIterator |
allShards(java.lang.String[] indices) |
ShardsIterator |
allShardsIncludingRelocationTargets(java.lang.String[] indices) |
static RoutingTable.Builder |
builder() |
static RoutingTable.Builder |
builder(RoutingTable routingTable) |
Diff<RoutingTable> |
diff(RoutingTable previousState)
Returns serializable object representing differences between this and previousState
|
ShardRouting |
getByAllocationId(ShardId shardId,
java.lang.String allocationId) |
ImmutableOpenMap<java.lang.String,IndexRoutingTable> |
getIndicesRouting() |
boolean |
hasIndex(Index index) |
boolean |
hasIndex(java.lang.String index) |
IndexRoutingTable |
index(Index index) |
IndexRoutingTable |
index(java.lang.String index) |
ImmutableOpenMap<java.lang.String,IndexRoutingTable> |
indicesRouting() |
java.util.Iterator<IndexRoutingTable> |
iterator() |
static Diff<RoutingTable> |
readDiffFrom(StreamInput in) |
static RoutingTable |
readFrom(StreamInput in) |
IndexShardRoutingTable |
shardRoutingTable(ShardId shardId)
All shards for the provided
ShardId |
IndexShardRoutingTable |
shardRoutingTable(java.lang.String index,
int shardId)
All shards for the provided index and shard id
|
IndexShardRoutingTable |
shardRoutingTableOrNull(ShardId shardId) |
java.util.List<ShardRouting> |
shardsWithState(ShardRoutingState state) |
java.lang.String |
toString() |
boolean |
validate(MetaData metaData) |
long |
version()
Returns the version of the
RoutingTable. |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
public static final RoutingTable EMPTY_ROUTING_TABLE
public long version()
RoutingTable.RoutingTablepublic java.util.Iterator<IndexRoutingTable> iterator()
iterator in interface java.lang.Iterable<IndexRoutingTable>public boolean hasIndex(java.lang.String index)
public boolean hasIndex(Index index)
public IndexRoutingTable index(java.lang.String index)
public IndexRoutingTable index(Index index)
public ImmutableOpenMap<java.lang.String,IndexRoutingTable> indicesRouting()
public ImmutableOpenMap<java.lang.String,IndexRoutingTable> getIndicesRouting()
public IndexShardRoutingTable shardRoutingTable(java.lang.String index, int shardId)
IndexNotFoundException - if provided index does not existShardNotFoundException - if provided shard id is unknownpublic IndexShardRoutingTable shardRoutingTable(ShardId shardId)
ShardIdIndexNotFoundException - if provided index does not existShardNotFoundException - if provided shard id is unknownpublic IndexShardRoutingTable shardRoutingTableOrNull(ShardId shardId)
@Nullable public ShardRouting getByAllocationId(ShardId shardId, java.lang.String allocationId)
public boolean validate(MetaData metaData)
public java.util.List<ShardRouting> shardsWithState(ShardRoutingState state)
public java.util.List<ShardRouting> allShards()
public java.util.List<ShardRouting> allShards(java.lang.String index)
index - The index to return all the shards (replicas).IndexNotFoundException - If the index passed does not existspublic GroupShardsIterator allActiveShardsGrouped(java.lang.String[] indices, boolean includeEmpty)
public GroupShardsIterator allActiveShardsGrouped(java.lang.String[] indices, boolean includeEmpty, boolean includeRelocationTargets)
includeEmpty - if true, a shard iterator will be added for non-assigned shards as wellincludeRelocationTargets - if true, an extra shard iterator will be added for relocating shards. The extra
iterator contains a single ShardRouting pointing at the relocating targetpublic GroupShardsIterator<ShardIterator> allAssignedShardsGrouped(java.lang.String[] indices, boolean includeEmpty)
public GroupShardsIterator<ShardIterator> allAssignedShardsGrouped(java.lang.String[] indices, boolean includeEmpty, boolean includeRelocationTargets)
includeEmpty - if true, a shard iterator will be added for non-assigned shards as wellincludeRelocationTargets - if true, an extra shard iterator will be added for relocating shards. The extra
iterator contains a single ShardRouting pointing at the relocating targetpublic ShardsIterator allShards(java.lang.String[] indices)
public ShardsIterator allShardsIncludingRelocationTargets(java.lang.String[] indices)
public GroupShardsIterator<ShardIterator> activePrimaryShardsGrouped(java.lang.String[] indices, boolean includeEmpty)
indices - The indices to return all the shards (replicas)IndexNotFoundException - If an index passed does not existspublic Diff<RoutingTable> diff(RoutingTable previousState)
Diffablediff in interface Diffable<RoutingTable>public static Diff<RoutingTable> readDiffFrom(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic static RoutingTable readFrom(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablepublic static RoutingTable.Builder builder()
public static RoutingTable.Builder builder(RoutingTable routingTable)
public java.lang.String toString()
toString in class java.lang.Object