Class GroupShardsIterator<ShardIt extends ShardIterator>

java.lang.Object
org.elasticsearch.cluster.routing.GroupShardsIterator<ShardIt>
All Implemented Interfaces:
java.lang.Iterable<ShardIt>

public final class GroupShardsIterator<ShardIt extends ShardIterator>
extends java.lang.Object
implements java.lang.Iterable<ShardIt>
This class implements a compilation of ShardIterators. Each ShardIterator iterated by this Iterable represents a group of shards. ShardsIterators are always returned in ascending order independently of their order at construction time. The incoming iterators are sorted to ensure consistent iteration behavior across Nodes / JVMs.
  • Constructor Summary

    Constructors 
    Constructor Description
    GroupShardsIterator​(java.util.List<ShardIt> iterators)
    Constructs a enw GroupShardsIterator from the given list.
    GroupShardsIterator​(java.util.List<ShardIt> iterators, boolean useSort)
    Constructs a new GroupShardsIterator from the given list.
  • Method Summary

    Modifier and Type Method Description
    ShardIt get​(int index)  
    java.util.Iterator<ShardIt> iterator()  
    int size()
    Return the number of groups
    int totalSize()
    Returns the total number of shards within all groups
    int totalSizeWith1ForEmpty()
    Returns the total number of shards plus the number of empty groups

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • GroupShardsIterator

      public GroupShardsIterator​(java.util.List<ShardIt> iterators)
      Constructs a enw GroupShardsIterator from the given list.
    • GroupShardsIterator

      public GroupShardsIterator​(java.util.List<ShardIt> iterators, boolean useSort)
      Constructs a new GroupShardsIterator from the given list.
  • Method Details

    • totalSize

      public int totalSize()
      Returns the total number of shards within all groups
      Returns:
      total number of shards
    • totalSizeWith1ForEmpty

      public int totalSizeWith1ForEmpty()
      Returns the total number of shards plus the number of empty groups
      Returns:
      number of shards and empty groups
    • size

      public int size()
      Return the number of groups
      Returns:
      number of groups
    • iterator

      public java.util.Iterator<ShardIt> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<ShardIt extends ShardIterator>
    • get

      public ShardIt get​(int index)