java.lang.Object
java.lang.Record
org.elasticsearch.compute.data.BatchMetadata
- Record Components:
batchId- the unique identifier for this batchpageIndexInBatch- 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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
ConstructorsConstructorDescriptionBatchMetadata(long batchId, int pageIndexInBatch, boolean isLastPageInBatch) Creates an instance of aBatchMetadatarecord class. -
Method Summary
Modifier and TypeMethodDescriptionlongbatchId()Returns the value of thebatchIdrecord component.static BatchMetadatacreateMarker(long batchId, int pageIndexInBatch) Create a marker metadata for batch completion.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisLastPageInBatchrecord component.intReturns the value of thepageIndexInBatchrecord component.static BatchMetadatareadFrom(StreamInput in) Read BatchMetadata from a stream.final StringtoString()Returns a string representation of this record class.voidwriteTo(StreamOutput out)
-
Constructor Details
-
BatchMetadata
public BatchMetadata(long batchId, int pageIndexInBatch, boolean isLastPageInBatch) Creates an instance of aBatchMetadatarecord class.- Parameters:
batchId- the value for thebatchIdrecord componentpageIndexInBatch- the value for thepageIndexInBatchrecord componentisLastPageInBatch- the value for theisLastPageInBatchrecord component
-
-
Method Details
-
createMarker
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 IDpageIndexInBatch- the index of this marker within the batch (0 for empty batches, or the next index if pages were already sent)
-
readFrom
Read BatchMetadata from a stream.- Throws:
IOException
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
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. All components in this record class are compared with '=='. -
batchId
public long batchId()Returns the value of thebatchIdrecord component.- Returns:
- the value of the
batchIdrecord component
-
pageIndexInBatch
public int pageIndexInBatch()Returns the value of thepageIndexInBatchrecord component.- Returns:
- the value of the
pageIndexInBatchrecord component
-
isLastPageInBatch
public boolean isLastPageInBatch()Returns the value of theisLastPageInBatchrecord component.- Returns:
- the value of the
isLastPageInBatchrecord component
-