Class HsFileDataIndexImpl
- java.lang.Object
-
- org.apache.flink.runtime.io.network.partition.hybrid.HsFileDataIndexImpl
-
- All Implemented Interfaces:
HsFileDataIndex
@ThreadSafe public class HsFileDataIndexImpl extends Object implements HsFileDataIndex
Default implementation ofHsFileDataIndex.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classHsFileDataIndexImpl.HsFileDataIndexRegionHelperThe implementation ofFileDataIndexRegionHelperto writing a region to the file or reading a region from the file.static classHsFileDataIndexImpl.InternalRegionAHsFileDataIndexImpl.InternalRegionis an implementation ofFileDataIndexRegionHelper.Region.-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.network.partition.hybrid.HsFileDataIndex
HsFileDataIndex.ReadableRegion, HsFileDataIndex.SpilledBuffer
-
-
Constructor Summary
Constructors Constructor Description HsFileDataIndexImpl(int numSubpartitions, Path indexFilePath, int regionGroupSizeInBytes, long numRetainedInMemoryRegionsMax)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBuffers(List<HsFileDataIndex.SpilledBuffer> spilledBuffers)Add buffers to the index.voidclose()Close this file data index.Optional<HsFileDataIndex.ReadableRegion>getReadableRegion(int subpartitionId, int bufferIndex, int consumingOffset)Get aHsFileDataIndex.ReadableRegionfor the given subpartition that starts with the given buffer index, if existed.voidmarkBufferReleased(int subpartitionId, int bufferIndex)Mark a buffer as RELEASED.
-
-
-
Constructor Detail
-
HsFileDataIndexImpl
public HsFileDataIndexImpl(int numSubpartitions, Path indexFilePath, int regionGroupSizeInBytes, long numRetainedInMemoryRegionsMax)
-
-
Method Detail
-
close
public void close()
Description copied from interface:HsFileDataIndexClose this file data index.- Specified by:
closein interfaceHsFileDataIndex
-
getReadableRegion
public Optional<HsFileDataIndex.ReadableRegion> getReadableRegion(int subpartitionId, int bufferIndex, int consumingOffset)
Description copied from interface:HsFileDataIndexGet aHsFileDataIndex.ReadableRegionfor the given subpartition that starts with the given buffer index, if existed.Note: Depending on the implementation, this method does not guarantee to always return the longest possible readable region.
- Specified by:
getReadableRegionin interfaceHsFileDataIndex- Parameters:
subpartitionId- that the readable region belongs tobufferIndex- that the readable region starts withconsumingOffset- of the downstream- Returns:
- a
HsFileDataIndex.ReadableRegionfor the given subpartition that starts with the given buffer index, if exist; otherwise,Optional.empty().
-
addBuffers
public void addBuffers(List<HsFileDataIndex.SpilledBuffer> spilledBuffers)
Description copied from interface:HsFileDataIndexAdd buffers to the index.Attention: this method only called by spilling thread.
- Specified by:
addBuffersin interfaceHsFileDataIndex- Parameters:
spilledBuffers- to be added. The buffers in the list are expected in the same order as in the spilled file.
-
markBufferReleased
public void markBufferReleased(int subpartitionId, int bufferIndex)Description copied from interface:HsFileDataIndexMark a buffer as RELEASED.- Specified by:
markBufferReleasedin interfaceHsFileDataIndex- Parameters:
subpartitionId- that the buffer belongs tobufferIndex- of the buffer within the subpartition
-
-