public class HsSubpartitionFileReaderImpl extends Object implements HsSubpartitionFileReader
HsSubpartitionFileReader.
Note: This class is not thread safe.
| 限定符和类型 | 类和说明 |
|---|---|
static class |
HsSubpartitionFileReaderImpl.BufferIndexOrError
Indicates a buffer with index or an error.
|
static class |
HsSubpartitionFileReaderImpl.Factory
Factory of
HsSubpartitionFileReader. |
| 构造器和说明 |
|---|
HsSubpartitionFileReaderImpl(int subpartitionId,
FileChannel dataFileChannel,
HsSubpartitionViewInternalOperations operations,
HsFileDataIndex dataIndex,
int maxBufferReadAhead,
java.util.function.Consumer<HsSubpartitionFileReader> fileReaderReleaser,
ByteBuffer headerBuf) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
compareTo(HsSubpartitionFileReader that)
Provides priority calculation logic for io scheduler.
|
Optional<ResultSubpartition.BufferAndBacklog> |
consumeBuffer(int nextBufferToConsume)
Try to consume next buffer.
|
boolean |
equals(Object o) |
void |
fail(Throwable failureCause)
Fail this
HsSubpartitionFileReader caused by failureCause. |
int |
getBacklog()
Get the number of buffers backlog.
|
Deque<HsSubpartitionFileReaderImpl.BufferIndexOrError> |
getLoadedBuffers() |
int |
hashCode() |
Buffer.DataType |
peekNextToConsumeDataType(int nextBufferToConsume)
Get dataType of next buffer to consume.
|
void |
prepareForScheduling()
Refresh downstream consumption progress for another round scheduling of reading.
|
void |
readBuffers(Queue<org.apache.flink.core.memory.MemorySegment> buffers,
BufferRecycler recycler)
Read subpartition data into buffers.
|
void |
releaseDataView()
Release this
HsDataView when related subpartition view is releasing. |
public HsSubpartitionFileReaderImpl(int subpartitionId,
FileChannel dataFileChannel,
HsSubpartitionViewInternalOperations operations,
HsFileDataIndex dataIndex,
int maxBufferReadAhead,
java.util.function.Consumer<HsSubpartitionFileReader> fileReaderReleaser,
ByteBuffer headerBuf)
public void readBuffers(Queue<org.apache.flink.core.memory.MemorySegment> buffers, BufferRecycler recycler) throws IOException
This transfers the ownership of used buffers to this class. It's this class' responsibility to release the buffers using the recycler when no longer needed.
Calling this method does not always use up all the provided buffers. It's this class' decision when to stop reading. Currently, it stops reading when: 1) buffers are used up, or 2) reaches the end of the subpartition data within the region, or 3) enough data have been read ahead the downstream consuming offset.
readBuffers 在接口中 HsSubpartitionFileReaderbuffers - for reading, note that the ownership of the buffer taken out from the queue is
transferred to this class, and the unused buffer must be returned.recycler - to return buffer to read buffer pool.IOExceptionpublic void fail(Throwable failureCause)
HsSubpartitionFileReaderHsSubpartitionFileReader caused by failureCause.fail 在接口中 HsSubpartitionFileReaderfailureCause - represents the reason why it failed.public void prepareForScheduling()
prepareForScheduling 在接口中 HsSubpartitionFileReaderpublic int compareTo(HsSubpartitionFileReader that)
compareTo 在接口中 Comparable<HsSubpartitionFileReader>public Deque<HsSubpartitionFileReaderImpl.BufferIndexOrError> getLoadedBuffers()
public Optional<ResultSubpartition.BufferAndBacklog> consumeBuffer(int nextBufferToConsume) throws Throwable
HsDataViewOnly invoked by consumer thread.
consumeBuffer 在接口中 HsDataViewnextBufferToConsume - next buffer index to consume.Optional.empty().Throwablepublic Buffer.DataType peekNextToConsumeDataType(int nextBufferToConsume)
HsDataViewpeekNextToConsumeDataType 在接口中 HsDataViewnextBufferToConsume - next buffer index to consumeBuffer.DataType.NONE.public void releaseDataView()
HsDataViewHsDataView when related subpartition view is releasing.releaseDataView 在接口中 HsDataViewpublic int getBacklog()
HsDataViewgetBacklog 在接口中 HsDataViewCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.