java.lang.Object
org.elasticsearch.compute.operator.exchange.BatchContext

public final class BatchContext extends Object
Shared context for batch state management between BatchDriver and PageToBatchPageOperator.

Batch lifecycle states:

 NOT_STARTED ──► ACTIVE ──► DRAINING ──► IDLE ──► ACTIVE ──► DRAINING ──► IDLE ...
                 (first batch)          (subsequent batches)
 

Thread safety: This class is designed for single-threaded driver execution.

  • Constructor Details

    • BatchContext

      public BatchContext()
  • Method Details

    • getState

      public BatchContext.BatchLifecycle getState()
      Get the current batch state.
    • getBatchId

      public long getBatchId()
      Get the current batch ID.
      Returns:
      the current batch ID, or UNDEFINED_BATCH_ID if no batch is active
    • isBatchActive

      public boolean isBatchActive()
      Check if a batch is currently active (ACTIVE or DRAINING).