public class HsSubpartitionMemoryDataManager extends Object implements HsDataView
HsMemoryDataManager
will hold multiple HsSubpartitionMemoryDataManager
.Modifier and Type | Method and Description |
---|---|
void |
append(ByteBuffer record,
Buffer.DataType dataType)
Append record to
HsSubpartitionMemoryDataManager . |
Optional<ResultSubpartition.BufferAndBacklog> |
consumeBuffer(int toConsumeIndex)
Check whether the head of
unConsumedBuffers is the buffer to be consumed. |
int |
getBacklog()
Get the number of buffers backlog.
|
Deque<BufferIndexAndChannel> |
getBuffersSatisfyStatus(HsSpillingInfoProvider.SpillStatus spillStatus,
HsSpillingInfoProvider.ConsumeStatus consumeStatus)
Get buffers in
allBuffers that satisfy expected HsSpillingInfoProvider.SpillStatus and HsSpillingInfoProvider.ConsumeStatus . |
Buffer.DataType |
peekNextToConsumeDataType(int nextToConsumeIndex)
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. |
void |
releaseSubpartitionBuffers(List<BufferIndexAndChannel> toRelease)
Release this subpartition's buffers in a decision.
|
void |
setOutputMetrics(HsOutputMetrics outputMetrics) |
List<BufferWithIdentity> |
spillSubpartitionBuffers(List<BufferIndexAndChannel> toSpill,
CompletableFuture<Void> spillDoneFuture)
Spill this subpartition's buffers in a decision.
|
public Buffer.DataType peekNextToConsumeDataType(int nextToConsumeIndex)
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.unConsumedBuffers
is target, return the buffer's data type.
Otherwise, return Buffer.DataType.NONE
.public Optional<ResultSubpartition.BufferAndBacklog> consumeBuffer(int toConsumeIndex)
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.unConsumedBuffers
is target, return optional of the buffer
and backlog. Otherwise, return Optional.empty()
.public int getBacklog()
HsDataView
getBacklog
in interface HsDataView
public void releaseDataView()
HsDataView
HsDataView
when related subpartition view is releasing.releaseDataView
in interface HsDataView
public void append(ByteBuffer record, Buffer.DataType dataType) throws InterruptedException
HsSubpartitionMemoryDataManager
.record
- to be managed by this class.dataType
- the type of this record. In other words, is it data or event.InterruptedException
public Deque<BufferIndexAndChannel> getBuffersSatisfyStatus(HsSpillingInfoProvider.SpillStatus spillStatus, HsSpillingInfoProvider.ConsumeStatus consumeStatus)
allBuffers
that satisfy expected HsSpillingInfoProvider.SpillStatus
and HsSpillingInfoProvider.ConsumeStatus
.spillStatus
- the status of spilling expected.consumeStatus
- the status of consuming expected.public List<BufferWithIdentity> spillSubpartitionBuffers(List<BufferIndexAndChannel> toSpill, CompletableFuture<Void> spillDoneFuture)
toSpill
- All buffers that need to be spilled belong to this subpartition in a decision.spillDoneFuture
- completed when spill is finished.BufferWithIdentity
s about these spill buffers.public void releaseSubpartitionBuffers(List<BufferIndexAndChannel> toRelease)
toRelease
- All buffers that need to be released belong to this subpartition in a
decision.public void setOutputMetrics(HsOutputMetrics outputMetrics)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.