Interface DataBuffer
-
- All Known Implementing Classes:
HashBasedDataBuffer,SortBasedDataBuffer,SortBuffer,TieredStorageSortBuffer
public interface DataBufferData of different subpartitions can be appended to aDataBufferand after theDataBufferis full or finished, the appended data can be copied from it in subpartition index order.The lifecycle of a
DataBuffercan be: new, write, [read, reset, write], finish, read, release. There can be multiple [read, reset, write] operations before finish.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanappend(ByteBuffer source, int targetSubpartition, Buffer.DataType dataType)Appends data of the specified subpartition to thisDataBufferand returns true if thisDataBufferis full.voidfinish()Finishes thisDataBufferwhich means no record can be appended anymore.BufferWithSubpartitiongetNextBuffer(org.apache.flink.core.memory.MemorySegment transitBuffer)Copies data in thisDataBufferto the targetMemorySegmentin subpartition index order and returnsBufferWithSubpartitionwhich contains the copied data and the corresponding subpartition index.booleanhasRemaining()Returns true if not all data appended to thisDataBufferis consumed.booleanisFinished()Whether thisDataBufferis finished or not.booleanisReleased()Whether thisDataBufferis released or not.longnumTotalBytes()Returns the total number of bytes written to thisDataBuffer.longnumTotalRecords()Returns the total number of records written to thisDataBuffer.voidrelease()Releases thisDataBufferwhich releases all resources.
-
-
-
Method Detail
-
append
boolean append(ByteBuffer source, int targetSubpartition, Buffer.DataType dataType) throws IOException
Appends data of the specified subpartition to thisDataBufferand returns true if thisDataBufferis full.- Throws:
IOException
-
getNextBuffer
BufferWithSubpartition getNextBuffer(@Nullable org.apache.flink.core.memory.MemorySegment transitBuffer)
Copies data in thisDataBufferto the targetMemorySegmentin subpartition index order and returnsBufferWithSubpartitionwhich contains the copied data and the corresponding subpartition index.
-
numTotalRecords
long numTotalRecords()
Returns the total number of records written to thisDataBuffer.
-
numTotalBytes
long numTotalBytes()
Returns the total number of bytes written to thisDataBuffer.
-
hasRemaining
boolean hasRemaining()
Returns true if not all data appended to thisDataBufferis consumed.
-
finish
void finish()
Finishes thisDataBufferwhich means no record can be appended anymore.
-
isFinished
boolean isFinished()
Whether thisDataBufferis finished or not.
-
release
void release()
Releases thisDataBufferwhich releases all resources.
-
isReleased
boolean isReleased()
Whether thisDataBufferis released or not.
-
-