Class RoutingNodes.UnassignedShards.UnassignedIterator
java.lang.Object
org.elasticsearch.cluster.routing.RoutingNodes.UnassignedShards.UnassignedIterator
- All Implemented Interfaces:
Iterator<ShardRouting>
,ExistingShardsAllocator.UnassignedAllocationHandler
- Enclosing class:
- RoutingNodes.UnassignedShards
public class RoutingNodes.UnassignedShards.UnassignedIterator
extends Object
implements Iterator<ShardRouting>, ExistingShardsAllocator.UnassignedAllocationHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
initialize
(String nodeId, String existingAllocationId, long expectedShardSize, RoutingChangesObserver routingChangesObserver) Initializes the current unassigned shard and moves it from the unassigned list.next()
void
remove()
Unsupported operation, just there for the interface.void
removeAndIgnore
(UnassignedInfo.AllocationStatus attempt, RoutingChangesObserver changes) Removes and ignores the unassigned shard (will be ignored for this run, but will be added back to unassigned once the metadata is constructed again).updateUnassigned
(UnassignedInfo unassignedInfo, RecoverySource recoverySource, RoutingChangesObserver changes) updates the unassigned info and recovery source on the current unassigned shardMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
UnassignedIterator
public UnassignedIterator()
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNext
in interfaceIterator<ShardRouting>
-
next
- Specified by:
next
in interfaceIterator<ShardRouting>
-
initialize
public ShardRouting initialize(String nodeId, @Nullable String existingAllocationId, long expectedShardSize, RoutingChangesObserver routingChangesObserver) Initializes the current unassigned shard and moves it from the unassigned list.- Specified by:
initialize
in interfaceExistingShardsAllocator.UnassignedAllocationHandler
- Parameters:
existingAllocationId
- allocation id to use. If null, a fresh allocation id is generated.
-
removeAndIgnore
public void removeAndIgnore(UnassignedInfo.AllocationStatus attempt, RoutingChangesObserver changes) Removes and ignores the unassigned shard (will be ignored for this run, but will be added back to unassigned once the metadata is constructed again). Typically this is used when an allocation decision prevents a shard from being allocated such that subsequent consumers of this API won't try to allocate this shard again.- Specified by:
removeAndIgnore
in interfaceExistingShardsAllocator.UnassignedAllocationHandler
- Parameters:
attempt
- the result of the allocation attempt
-
updateUnassigned
public ShardRouting updateUnassigned(UnassignedInfo unassignedInfo, RecoverySource recoverySource, RoutingChangesObserver changes) updates the unassigned info and recovery source on the current unassigned shard- Specified by:
updateUnassigned
in interfaceExistingShardsAllocator.UnassignedAllocationHandler
- Parameters:
unassignedInfo
- the new unassigned info to userecoverySource
- the new recovery source to use- Returns:
- the shard with unassigned info updated
-
remove
public void remove()Unsupported operation, just there for the interface. UseremoveAndIgnore(AllocationStatus, RoutingChangesObserver)
orinitialize(String, String, long, RoutingChangesObserver)
.- Specified by:
remove
in interfaceIterator<ShardRouting>
-