Interface Chunk
-
public interface ChunkChunk is a logically contiguous space backed by one or multipleByteBuffer.For example: a Chunk of 1G size may be backed by one
MappedByteBufferfrom a memory-mapped 1G file, or multipleHeapByteBuffer/DirectByteBuffer.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intallocate(int len)Try to allocate size bytes from the chunk.voidfree(int interChunkOffset)release the space addressed by interChunkOffset.intgetChunkCapacity()intgetChunkId()org.apache.flink.core.memory.MemorySegmentgetMemorySegment(int chunkOffset)intgetOffsetInSegment(int offsetInChunk)
-
-
-
Method Detail
-
allocate
int allocate(int len)
Try to allocate size bytes from the chunk.- Parameters:
len- size of bytes to allocate.- Returns:
- the offset of the successful allocation, or -1 to indicate not-enough-space
-
free
void free(int interChunkOffset)
release the space addressed by interChunkOffset.- Parameters:
interChunkOffset- offset of the chunk
-
getChunkId
int getChunkId()
- Returns:
- Id of this Chunk
-
getChunkCapacity
int getChunkCapacity()
-
getMemorySegment
org.apache.flink.core.memory.MemorySegment getMemorySegment(int chunkOffset)
- Returns:
- This chunk's backing MemorySegment described by chunkOffset.
-
getOffsetInSegment
int getOffsetInSegment(int offsetInChunk)
- Parameters:
offsetInChunk- virtual and global address in chunk- Returns:
- chunk maybe compose of multi
MemorySegments, return the offset in certain one.
-
-