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<R>
Modifier and Type | Field and Description |
---|---|
static RoutingTable |
EMPTY_ROUTING_TABLE |
static RoutingTable |
PROTO |
Modifier and Type | Method and Description |
---|---|
GroupShardsIterator |
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 |
allAssignedShardsGrouped(java.lang.String[] indices,
boolean includeEmpty) |
GroupShardsIterator |
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
|
ImmutableOpenMap<java.lang.String,IndexRoutingTable> |
getIndicesRouting() |
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() |
java.lang.String |
prettyPrint() |
Diff<RoutingTable> |
readDiffFrom(StreamInput in)
Reads the
Diff from StreamInput |
RoutingTable |
readFrom(StreamInput in)
Reads an object of this type from the provided StreamInput.
|
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) |
RoutingTableValidation |
validate(MetaData metaData) |
RoutingTable |
validateRaiseException(MetaData metaData) |
long |
version()
Returns the version of the
RoutingTable . |
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
public static RoutingTable PROTO
public static final RoutingTable EMPTY_ROUTING_TABLE
public long version()
RoutingTable
.RoutingTable
public java.util.Iterator<IndexRoutingTable> iterator()
iterator
in interface java.lang.Iterable<IndexRoutingTable>
public boolean hasIndex(java.lang.String 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)
ShardId
IndexNotFoundException
- if provided index does not existShardNotFoundException
- if provided shard id is unknownpublic IndexShardRoutingTable shardRoutingTableOrNull(ShardId shardId)
public RoutingTable validateRaiseException(MetaData metaData) throws RoutingValidationException
RoutingValidationException
public RoutingTableValidation 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 allAssignedShardsGrouped(java.lang.String[] indices, boolean includeEmpty)
public GroupShardsIterator 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 activePrimaryShardsGrouped(java.lang.String[] indices, boolean includeEmpty)
indices
- The indices to return all the shards (replicas)IndexNotFoundException
- If an index passed does not existsIndexRoutingTable.groupByAllIt()
public Diff<RoutingTable> diff(RoutingTable previousState)
Diffable
diff
in interface Diffable<RoutingTable>
public Diff<RoutingTable> readDiffFrom(StreamInput in) throws java.io.IOException
Diffable
Diff
from StreamInputreadDiffFrom
in interface Diffable<RoutingTable>
java.io.IOException
public RoutingTable readFrom(StreamInput in) throws java.io.IOException
StreamableReader
readFrom
in interface StreamableReader<RoutingTable>
readFrom
in interface Writeable<RoutingTable>
java.io.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
writeTo
in interface Writeable<RoutingTable>
java.io.IOException
public static RoutingTable.Builder builder()
public static RoutingTable.Builder builder(RoutingTable routingTable)
public java.lang.String prettyPrint()