Class RoutingNode
- java.lang.Object
-
- org.elasticsearch.cluster.routing.RoutingNode
-
- All Implemented Interfaces:
java.lang.Iterable<ShardRouting>
public class RoutingNode extends java.lang.Object implements java.lang.Iterable<ShardRouting>
ARoutingNode
represents a cluster node associated with a singleDiscoveryNode
including all shards that are hosted on that nodes. EachRoutingNode
has a unique node id that can be used to identify the node.
-
-
Constructor Summary
Constructors Constructor Description RoutingNode(java.lang.String nodeId, DiscoveryNode node, ShardRouting... shards)
-
Method Summary
Modifier and Type Method Description java.util.List<ShardRouting>
copyShards()
ShardRouting
getByShardId(ShardId id)
boolean
isEmpty()
java.util.Iterator<ShardRouting>
iterator()
DiscoveryNode
node()
Returns the nodesDiscoveryNode
.java.lang.String
nodeId()
Get the id of this nodeint
numberOfOwningShards()
The number of shards on this node that will not be eventually relocated.int
numberOfShardsWithState(ShardRoutingState... states)
Determine the number of shards with a specific statejava.lang.String
prettyPrint()
java.util.List<ShardRouting>
shardsWithState(java.lang.String index, ShardRoutingState... states)
Determine the shards of an index with a specific statejava.util.List<ShardRouting>
shardsWithState(ShardRoutingState... states)
Determine the shards with a specific stateint
size()
java.lang.String
toString()
-
-
-
Constructor Detail
-
RoutingNode
public RoutingNode(java.lang.String nodeId, DiscoveryNode node, ShardRouting... shards)
-
-
Method Detail
-
iterator
public java.util.Iterator<ShardRouting> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<ShardRouting>
-
node
public DiscoveryNode node()
Returns the nodesDiscoveryNode
.- Returns:
- discoveryNode of this node
-
getByShardId
@Nullable public ShardRouting getByShardId(ShardId id)
-
nodeId
public java.lang.String nodeId()
Get the id of this node- Returns:
- id of the node
-
size
public int size()
-
numberOfShardsWithState
public int numberOfShardsWithState(ShardRoutingState... states)
Determine the number of shards with a specific state- Parameters:
states
- set of states which should be counted- Returns:
- number of shards
-
shardsWithState
public java.util.List<ShardRouting> shardsWithState(ShardRoutingState... states)
Determine the shards with a specific state- Parameters:
states
- set of states which should be listed- Returns:
- List of shards
-
shardsWithState
public java.util.List<ShardRouting> shardsWithState(java.lang.String index, ShardRoutingState... states)
Determine the shards of an index with a specific state- Parameters:
index
- id of the indexstates
- set of states which should be listed- Returns:
- a list of shards
-
numberOfOwningShards
public int numberOfOwningShards()
The number of shards on this node that will not be eventually relocated.
-
prettyPrint
public java.lang.String prettyPrint()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
copyShards
public java.util.List<ShardRouting> copyShards()
-
isEmpty
public boolean isEmpty()
-
-