Module org.elasticsearch.server
Package org.elasticsearch.action.search
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 Summary
ConstructorsConstructorDescriptionSearchTimeProvider
(long absoluteStartMillis, long relativeStartNanos, LongSupplier relativeCurrentNanosProvider) Instantiates a new search time provider. -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the value of theabsoluteStartMillis
record component.long
final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of therelativeCurrentNanosProvider
record component.long
Returns the value of therelativeStartNanos
record component.final String
toString()
Returns a string representation of this record class.
-
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 epochrelativeStartNanos
- the relative start time in nanosecondsrelativeCurrentNanosProvider
- provides the current relative time
-
-
Method Details
-
buildTookInMillis
public long buildTookInMillis() -
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. -
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. -
equals
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 withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
absoluteStartMillis
public long absoluteStartMillis()Returns the value of theabsoluteStartMillis
record component.- Returns:
- the value of the
absoluteStartMillis
record component
-
relativeStartNanos
public long relativeStartNanos()Returns the value of therelativeStartNanos
record component.- Returns:
- the value of the
relativeStartNanos
record component
-
relativeCurrentNanosProvider
Returns the value of therelativeCurrentNanosProvider
record component.- Returns:
- the value of the
relativeCurrentNanosProvider
record component
-