java.lang.Object
org.elasticsearch.compute.operator.Driver
All Implemented Interfaces:
Closeable, AutoCloseable, Describable, org.elasticsearch.core.Releasable

public class Driver extends Object implements org.elasticsearch.core.Releasable, Describable
A driver operates single-threadedly on a simple chain of Operators, passing Pages from one operator to the next. It also controls the lifecycle of the operators. The operator chain typically starts with a source operator (i.e. an operator that purely produces pages) and ends with a sink operator (i.e. an operator that purely consumes pages). More details on how this integrates with other components can be found in the package documentation of org.elasticsearch.compute
  • Field Details

    • DEFAULT_TIME_BEFORE_YIELDING

      public static final org.elasticsearch.core.TimeValue DEFAULT_TIME_BEFORE_YIELDING
    • DEFAULT_MAX_ITERATIONS

      public static final int DEFAULT_MAX_ITERATIONS
      See Also:
    • DEFAULT_STATUS_INTERVAL

      public static final org.elasticsearch.core.TimeValue DEFAULT_STATUS_INTERVAL
      Minimum time between updating status.
  • Constructor Details

    • Driver

      public Driver(String sessionId, long startTime, long startNanos, DriverContext driverContext, Supplier<String> description, SourceOperator source, List<Operator> intermediateOperators, SinkOperator sink, org.elasticsearch.core.TimeValue statusInterval, org.elasticsearch.core.Releasable releasable)
      Creates a new driver with a chain of operators.
      Parameters:
      sessionId - session Id
      driverContext - the driver context
      source - source operator
      intermediateOperators - the chain of operators to execute
      sink - sink operator
      statusInterval - minimum status reporting interval
      releasable - a Releasable to invoked once the chain of operators has run to completion
    • Driver

      public Driver(DriverContext driverContext, SourceOperator source, List<Operator> intermediateOperators, SinkOperator sink, org.elasticsearch.core.Releasable releasable)
      Creates a new driver with a chain of operators.
      Parameters:
      driverContext - the driver context
      source - source operator
      intermediateOperators - the chain of operators to execute
      sink - sink operator
      releasable - a Releasable to invoked once the chain of operators has run to completion
  • Method Details

    • driverContext

      public DriverContext driverContext()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.elasticsearch.core.Releasable
    • abort

      public void abort(Exception reason, ActionListener<Void> listener)
      Abort the driver and wait for it to finish
    • cancel

      public void cancel(String reason)
    • start

      public static void start(ThreadContext threadContext, Executor executor, Driver driver, int maxIterations, ActionListener<Void> listener)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • describe

      public String describe()
      Description copied from interface: Describable
      Returns a description of the component. This description can be more specific than Object::toString.
      Specified by:
      describe in interface Describable
      Returns:
      the description
    • sessionId

      public String sessionId()
    • status

      public DriverStatus status()
      Get the last status update from the driver. These updates are made when the driver is queued and after every processing batch.
    • profile

      public DriverProfile profile()
      Build a "profile" of this driver's operations after it's been completed. This doesn't make sense to call before the driver is done.