public class IndexShardRoutingTable extends Object implements Iterable<ShardRouting>
IndexShardRoutingTable
encapsulates all instances of a single shard.
Each Elasticsearch index consists of multiple shards, each shard encapsulates
a disjoint set of the index data and each shard has one or more instances
referred to as replicas of a shard. Given that, this class encapsulates all
replicas (instances) for a single index shard.Modifier and Type | Class and Description |
---|---|
static class |
IndexShardRoutingTable.Builder |
Modifier and Type | Method and Description |
---|---|
ShardIterator |
activeInitializingShardsIt(int seed)
Returns an iterator over active and initializing shards.
|
ShardIterator |
activeInitializingShardsRandomIt()
Returns an iterator over active and initializing shards.
|
com.google.common.collect.ImmutableList<ShardRouting> |
activeShards()
Returns a
ImmutableList of active shards |
ShardIterator |
activeShardsIt() |
ShardIterator |
activeShardsIt(int seed) |
ShardIterator |
activeShardsRandomIt() |
com.google.common.collect.ImmutableList<ShardRouting> |
assignedShards()
Returns a
ImmutableList of assigned shards |
ShardIterator |
assignedShardsIt() |
ShardIterator |
assignedShardsIt(int seed) |
ShardIterator |
assignedShardsRandomIt() |
int |
countWithState(ShardRoutingState state)
Returns the number of shards in a specific state
|
com.google.common.collect.ImmutableList<ShardRouting> |
getActiveShards()
Returns a
ImmutableList of active shards |
com.google.common.collect.ImmutableList<ShardRouting> |
getAssignedShards()
Returns a
ImmutableList of assigned shards |
ShardId |
getShardId()
Returns the shards id
|
com.google.common.collect.ImmutableList<ShardRouting> |
getShards()
Returns a
ImmutableList of shards |
int |
getSize()
Returns the number of this shards instances.
|
com.google.common.collect.UnmodifiableIterator<ShardRouting> |
iterator() |
IndexShardRoutingTable |
normalizeVersions()
Normalizes all shard routings to the same version.
|
ShardIterator |
onlyNodeActiveInitializingShardsIt(String nodeId) |
ShardIterator |
preferAttributesActiveInitializingShardsIt(String[] attributes,
DiscoveryNodes nodes) |
ShardIterator |
preferAttributesActiveInitializingShardsIt(String[] attributes,
DiscoveryNodes nodes,
int seed) |
ShardIterator |
preferNodeActiveInitializingShardsIt(String nodeId) |
ShardIterator |
primaryActiveInitializingShardIt() |
boolean |
primaryAllocatedPostApi()
Has this shard group primary shard been allocated post API creation.
|
ShardIterator |
primaryFirstActiveInitializingShardsIt() |
ShardRouting |
primaryShard() |
ShardIterator |
primaryShardIt()
Returns an iterator only on the primary shard.
|
List<ShardRouting> |
replicaShards() |
List<ShardRouting> |
replicaShardsWithState(ShardRoutingState... states) |
ShardId |
shardId()
Returns the shards id
|
com.google.common.collect.ImmutableList<ShardRouting> |
shards()
Returns a
ImmutableList of shards |
ShardIterator |
shardsIt() |
ShardIterator |
shardsIt(int seed) |
ShardIterator |
shardsRandomIt() |
List<ShardRouting> |
shardsWithState(ShardRoutingState state) |
int |
size()
Returns the number of this shards instances.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public IndexShardRoutingTable normalizeVersions()
public boolean primaryAllocatedPostApi()
true
if it was created because of recovery action.public ShardId shardId()
public ShardId getShardId()
public com.google.common.collect.UnmodifiableIterator<ShardRouting> iterator()
iterator
in interface Iterable<ShardRouting>
public int size()
public int getSize()
public com.google.common.collect.ImmutableList<ShardRouting> shards()
ImmutableList
of shardsImmutableList
of shardspublic com.google.common.collect.ImmutableList<ShardRouting> getShards()
ImmutableList
of shardsImmutableList
of shardspublic com.google.common.collect.ImmutableList<ShardRouting> activeShards()
ImmutableList
of active shardsImmutableList
of shardspublic com.google.common.collect.ImmutableList<ShardRouting> getActiveShards()
ImmutableList
of active shardsImmutableList
of shardspublic com.google.common.collect.ImmutableList<ShardRouting> assignedShards()
ImmutableList
of assigned shardsImmutableList
of shardspublic com.google.common.collect.ImmutableList<ShardRouting> getAssignedShards()
ImmutableList
of assigned shardsImmutableList
of shardspublic int countWithState(ShardRoutingState state)
state
- state of the shards to countstate
public ShardIterator shardsRandomIt()
public ShardIterator shardsIt()
public ShardIterator shardsIt(int seed)
public ShardIterator activeShardsRandomIt()
public ShardIterator activeShardsIt()
public ShardIterator activeShardsIt(int seed)
public ShardIterator activeInitializingShardsRandomIt()
public ShardIterator activeInitializingShardsIt(int seed)
public ShardIterator assignedShardsRandomIt()
public ShardIterator assignedShardsIt()
public ShardIterator assignedShardsIt(int seed)
public ShardIterator primaryShardIt()
public ShardIterator primaryActiveInitializingShardIt()
public ShardIterator primaryFirstActiveInitializingShardsIt()
public ShardIterator onlyNodeActiveInitializingShardsIt(String nodeId)
public ShardIterator preferNodeActiveInitializingShardsIt(String nodeId)
public ShardIterator preferAttributesActiveInitializingShardsIt(String[] attributes, DiscoveryNodes nodes)
public ShardIterator preferAttributesActiveInitializingShardsIt(String[] attributes, DiscoveryNodes nodes, int seed)
public ShardRouting primaryShard()
public List<ShardRouting> replicaShards()
public List<ShardRouting> replicaShardsWithState(ShardRoutingState... states)
public List<ShardRouting> shardsWithState(ShardRoutingState state)
Copyright © 2009–2015. All rights reserved.