Class GroupShardsIterator<ShardIt extends <ShardIt> & Countable>

org.elasticsearch.cluster.routing.GroupShardsIterator<ShardIt>
All Implemented Interfaces:
<ShardIt>

public final class GroupShardsIterator<ShardIt extends <ShardIt> & Countable> extends implements <ShardIt>
This class implements a compilation of ShardIterators. Each ShardIterator iterated by this 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
    <ShardIt> iterators)
    Constructs a new GroupShardsIterator from the given list.
  • Method Summary

    Modifier and Type
    Method
    Description
    get​(int index)
     
     
    int
    Return the number of groups
    static <ShardIt extends <ShardIt> & Countable>
    GroupShardsIterator<ShardIt>
    <ShardIt> iterators)
    Constructs a new sorted GroupShardsIterator from the given list.
    int
    Returns the total number of shards within all groups
    int
    Returns the total number of shards plus the number of empty groups

    Methods inherited from class java.lang.

    , , , , , , , , , ,

    Methods inherited from interface java.lang.

    ,
  • Constructor Details

    • GroupShardsIterator

      public GroupShardsIterator(<ShardIt> iterators)
      Constructs a new GroupShardsIterator from the given list.
  • Method Details

    • sortAndCreate

      public static <ShardIt extends <ShardIt> & Countable> <ShardIt> iterators)
      Constructs a new sorted GroupShardsIterator from the given list. Items are sorted based on their natural ordering.
      See Also:
      PlainShardIterator.compareTo(ShardIterator)
    • 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 <ShardIt> iterator()
      Specified by:
       in interface <<ShardIt> & Countable>
    • get

      public ShardIt get(int index)