Class RoutingNode
- java.lang.Object
-
- org.elasticsearch.cluster.routing.RoutingNode
-
- All Implemented Interfaces:
Iterable<ShardRouting>
public class RoutingNode extends Object implements Iterable<ShardRouting>
ARoutingNoderepresents a cluster node associated with a singleDiscoveryNodeincluding all shards that are hosted on that nodes. EachRoutingNodehas a unique node id that can be used to identify the node.
-
-
Constructor Summary
Constructors Constructor Description RoutingNode(String nodeId, DiscoveryNode node, ShardRouting... shards)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<ShardRouting>copyShards()ShardRoutinggetByShardId(ShardId id)booleanisEmpty()Iterator<ShardRouting>iterator()DiscoveryNodenode()Returns the nodesDiscoveryNode.StringnodeId()Get the id of this nodeintnumberOfOwningShards()The number of shards on this node that will not be eventually relocated.intnumberOfShardsWithState(ShardRoutingState... states)Determine the number of shards with a specific stateStringprettyPrint()List<ShardRouting>shardsWithState(String index, ShardRoutingState... states)Determine the shards of an index with a specific stateList<ShardRouting>shardsWithState(ShardRoutingState... states)Determine the shards with a specific stateintsize()StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
RoutingNode
public RoutingNode(String nodeId, DiscoveryNode node, ShardRouting... shards)
-
-
Method Detail
-
iterator
public Iterator<ShardRouting> iterator()
- Specified by:
iteratorin interfaceIterable<ShardRouting>
-
node
public DiscoveryNode node()
Returns the nodesDiscoveryNode.- Returns:
- discoveryNode of this node
-
getByShardId
@Nullable public ShardRouting getByShardId(ShardId id)
-
nodeId
public 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 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 List<ShardRouting> shardsWithState(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 String prettyPrint()
-
copyShards
public List<ShardRouting> copyShards()
-
isEmpty
public boolean isEmpty()
-
-