Record Class TransportSearchAction.SearchTimeProvider

java.lang.Object
java.lang.Record
org.elasticsearch.action.search.TransportSearchAction.SearchTimeProvider
Enclosing class:
TransportSearchAction

public static record TransportSearchAction.SearchTimeProvider(long absoluteStartMillis, long relativeStartNanos, LongSupplier relativeCurrentNanosProvider) extends Record
Search operations need two clocks. One clock is to fulfill real clock needs (e.g., resolving "now" to an index name). Another clock is needed for measuring how long a search operation took. These two uses are at odds with each other. There are many issues with using a real clock for measuring how long an operation took (they often lack precision, they are subject to moving backwards due to NTP and other such complexities, etc.). There are also issues with using a relative clock for reporting real time. Thus, we simply separate these two uses.
  • Constructor Details

    • SearchTimeProvider

      public SearchTimeProvider(long absoluteStartMillis, long relativeStartNanos, LongSupplier relativeCurrentNanosProvider)
      Instantiates a new search time provider. The absolute start time is the real clock time used for resolving index expressions that include dates. The relative start time is the start of the search operation according to a relative clock. The total time the search operation took can be measured against the provided relative clock and the relative start time.
      Parameters:
      absoluteStartMillis - the absolute start time in milliseconds since the epoch
      relativeStartNanos - the relative start time in nanoseconds
      relativeCurrentNanosProvider - provides the current relative time
  • Method Details

    • buildTookInMillis

      public long buildTookInMillis()
    • 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.
    • absoluteStartMillis

      public long absoluteStartMillis()
      Returns the value of the absoluteStartMillis record component.
      Returns:
      the value of the absoluteStartMillis record component
    • relativeStartNanos

      public long relativeStartNanos()
      Returns the value of the relativeStartNanos record component.
      Returns:
      the value of the relativeStartNanos record component
    • relativeCurrentNanosProvider

      public LongSupplier relativeCurrentNanosProvider()
      Returns the value of the relativeCurrentNanosProvider record component.
      Returns:
      the value of the relativeCurrentNanosProvider record component