Record Class BatchMetadata

java.lang.Object
java.lang.Record
org.elasticsearch.compute.data.BatchMetadata
Record Components:
batchId - the unique identifier for this batch
pageIndexInBatch - the index of this page within the batch (0-based)
isLastPageInBatch - true if this is the last page in the batch
All Implemented Interfaces:
Writeable

public record BatchMetadata(long batchId, int pageIndexInBatch, boolean isLastPageInBatch) extends Record implements Writeable
Metadata for batch processing in bidirectional batch exchanges. This allows batch boundaries and batch IDs to travel with pages through exchanges.
  • Constructor Details

    • BatchMetadata

      public BatchMetadata(long batchId, int pageIndexInBatch, boolean isLastPageInBatch)
      Creates an instance of a BatchMetadata record class.
      Parameters:
      batchId - the value for the batchId record component
      pageIndexInBatch - the value for the pageIndexInBatch record component
      isLastPageInBatch - the value for the isLastPageInBatch record component
  • Method Details

    • createMarker

      public static BatchMetadata createMarker(long batchId, int pageIndexInBatch)
      Create a marker metadata for batch completion. A marker is used with an empty page (0 positions, 0 blocks) to signal batch completion when a batch produces no output.
      Parameters:
      batchId - the batch ID
      pageIndexInBatch - the index of this marker within the batch (0 for empty batches, or the next index if pages were already sent)
    • readFrom

      public static BatchMetadata readFrom(StreamInput in) throws IOException
      Read BatchMetadata from a stream.
      Throws:
      IOException
    • writeTo

      public void writeTo(StreamOutput out) throws IOException
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • 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. All components in this record class 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.
    • batchId

      public long batchId()
      Returns the value of the batchId record component.
      Returns:
      the value of the batchId record component
    • pageIndexInBatch

      public int pageIndexInBatch()
      Returns the value of the pageIndexInBatch record component.
      Returns:
      the value of the pageIndexInBatch record component
    • isLastPageInBatch

      public boolean isLastPageInBatch()
      Returns the value of the isLastPageInBatch record component.
      Returns:
      the value of the isLastPageInBatch record component