Record Class AutoShardingResult

java.lang.Object
java.lang.Record
org.elasticsearch.action.datastreams.autosharding.AutoShardingResult

public record AutoShardingResult(AutoShardingType type, int currentNumberOfShards, int targetNumberOfShards, TimeValue coolDownRemaining, Double writeLoad) extends Record
Represents an auto sharding recommendation. It includes the current and target number of shards together with a remaining cooldown period that needs to lapse before the current recommendation should be applied.

If auto sharding is not applicable for a data stream (e.g. due to DataStreamAutoShardingService.DATA_STREAMS_AUTO_SHARDING_EXCLUDES_SETTING) the target number of shards will be -1 and cool down remaining TimeValue.MAX_VALUE.

  • Field Details

  • Constructor Details

    • AutoShardingResult

      public AutoShardingResult(AutoShardingType type, int currentNumberOfShards, int targetNumberOfShards, TimeValue coolDownRemaining, @Nullable Double writeLoad)
      Creates an instance of a AutoShardingResult record class.
      Parameters:
      type - the value for the type record component
      currentNumberOfShards - the value for the currentNumberOfShards record component
      targetNumberOfShards - the value for the targetNumberOfShards record component
      coolDownRemaining - the value for the coolDownRemaining record component
      writeLoad - the value for the writeLoad record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public AutoShardingType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • currentNumberOfShards

      public int currentNumberOfShards()
      Returns the value of the currentNumberOfShards record component.
      Returns:
      the value of the currentNumberOfShards record component
    • targetNumberOfShards

      public int targetNumberOfShards()
      Returns the value of the targetNumberOfShards record component.
      Returns:
      the value of the targetNumberOfShards record component
    • coolDownRemaining

      public TimeValue coolDownRemaining()
      Returns the value of the coolDownRemaining record component.
      Returns:
      the value of the coolDownRemaining record component
    • writeLoad

      @Nullable public Double writeLoad()
      Returns the value of the writeLoad record component.
      Returns:
      the value of the writeLoad record component