public class HsSubpartitionConsumerMemoryDataManager extends Object implements HsDataView
HsSubpartitionMemoryDataManager
will create a new HsSubpartitionConsumerMemoryDataManager
when a consumer is registered.Constructor and Description |
---|
HsSubpartitionConsumerMemoryDataManager(Lock resultPartitionLock,
Lock consumerLock,
int subpartitionId,
HsConsumerId consumerId,
HsMemoryDataManagerOperation memoryDataManagerOperation) |
Modifier and Type | Method and Description |
---|---|
boolean |
addBuffer(HsBufferContext bufferContext) |
void |
addInitialBuffers(Deque<HsBufferContext> buffers) |
Optional<ResultSubpartition.BufferAndBacklog> |
consumeBuffer(int toConsumeIndex,
Collection<Buffer> buffersToRecycle)
Check whether the head of
unConsumedBuffers is the buffer to be consumed. |
int |
getBacklog()
Get the number of buffers whose
Buffer.DataType is buffer. |
Buffer.DataType |
peekNextToConsumeDataType(int nextToConsumeIndex,
Collection<Buffer> buffersToRecycle)
Check whether the head of
unConsumedBuffers is the buffer to be consumed next time. |
void |
releaseDataView()
Release this
HsDataView when related subpartition view is releasing. |
public HsSubpartitionConsumerMemoryDataManager(Lock resultPartitionLock, Lock consumerLock, int subpartitionId, HsConsumerId consumerId, HsMemoryDataManagerOperation memoryDataManagerOperation)
public void addInitialBuffers(Deque<HsBufferContext> buffers)
public boolean addBuffer(HsBufferContext bufferContext)
public Optional<ResultSubpartition.BufferAndBacklog> consumeBuffer(int toConsumeIndex, Collection<Buffer> buffersToRecycle)
unConsumedBuffers
is the buffer to be consumed. If so,
return the buffer and backlog.consumeBuffer
in interface HsDataView
toConsumeIndex
- index of buffer to be consumed.buffersToRecycle
- buffers to recycle if needed.unConsumedBuffers
is target, return optional of the buffer
and backlog. Otherwise, return Optional.empty()
.public Buffer.DataType peekNextToConsumeDataType(int nextToConsumeIndex, Collection<Buffer> buffersToRecycle)
unConsumedBuffers
is the buffer to be consumed next time.
If so, return the next buffer's data type.peekNextToConsumeDataType
in interface HsDataView
nextToConsumeIndex
- index of the buffer to be consumed next time.buffersToRecycle
- buffers to recycle if needed.unConsumedBuffers
is target, return the buffer's data type.
Otherwise, return Buffer.DataType#NONE
.public int getBacklog()
HsDataView
Buffer.DataType
is buffer.getBacklog
in interface HsDataView
public void releaseDataView()
HsDataView
HsDataView
when related subpartition view is releasing.releaseDataView
in interface HsDataView
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.