Interface NetworkSequenceViewReader
public interface NetworkSequenceViewReader
Simple wrapper for the partition readerQueue iterator, which increments a sequence number for
each returned buffer and remembers the receiver ID.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAcknowledges all the user records are processed.voidaddCredit(int creditDeltas) The credits from consumer are added in incremental way.Checks whether this reader is available or not and returns the backlog at the same time.booleanbooleanbooleanReturns true if the producer backlog need to be announced to the consumer.voidnotifyNewBufferSize(int newBufferSize) voidnotifyPartitionRequestTimeout(PartitionRequestListener partitionRequestListener) When the partition request from the given downstream task is timeout, it should notify the reader in netty server and sendPartitionNotFoundExceptionto the task.voidnotifyRequiredSegmentId(int subpartitionId, int segmentId) Notify the id of required segment from consumer.voidnotifySubpartitionsCreated(ResultPartition partition, ResultSubpartitionIndexSet subpartitionIndexSet) When theResultPartitionManagerregistersResultPartition, it will get thePartitionRequestListenervia givenResultPartitionID, and create subpartition view reader for downstream task.intvoidvoidrequestSubpartitionViewOrRegisterListener(ResultPartitionProvider partitionProvider, ResultPartitionID resultPartitionId, ResultSubpartitionIndexSet subpartitionIndexSet) When the netty server receives the downstream task's partition request and the upstream task has registered its partition, it will process the partition request immediately, otherwise it will create aPartitionRequestListenerfor givenResultPartitionIDinResultPartitionManagerand notify the listener when the upstream task registers its partition.voidResumes data consumption after an exactly once checkpoint.voidsetRegisteredAsAvailable(boolean isRegisteredAvailable) Updates the value to indicate whether the reader is enqueued in the pipeline or not.
-
Method Details
-
requestSubpartitionViewOrRegisterListener
void requestSubpartitionViewOrRegisterListener(ResultPartitionProvider partitionProvider, ResultPartitionID resultPartitionId, ResultSubpartitionIndexSet subpartitionIndexSet) throws IOException When the netty server receives the downstream task's partition request and the upstream task has registered its partition, it will process the partition request immediately, otherwise it will create aPartitionRequestListenerfor givenResultPartitionIDinResultPartitionManagerand notify the listener when the upstream task registers its partition.- Parameters:
partitionProvider- the result partition providerresultPartitionId- the result partition idsubpartitionIndexSet- the sub partition indexes- Throws:
IOException- the thrown exception
-
notifySubpartitionsCreated
void notifySubpartitionsCreated(ResultPartition partition, ResultSubpartitionIndexSet subpartitionIndexSet) throws IOException When theResultPartitionManagerregistersResultPartition, it will get thePartitionRequestListenervia givenResultPartitionID, and create subpartition view reader for downstream task.- Parameters:
partition- the result partitionsubpartitionIndexSet- the sub partition indexes- Throws:
IOException- the thrown exception
-
peekNextBufferSubpartitionId
- Throws:
IOException
-
getNextBuffer
- Throws:
IOException
-
needAnnounceBacklog
boolean needAnnounceBacklog()Returns true if the producer backlog need to be announced to the consumer. -
addCredit
void addCredit(int creditDeltas) The credits from consumer are added in incremental way.- Parameters:
creditDeltas- The credit deltas
-
notifyRequiredSegmentId
void notifyRequiredSegmentId(int subpartitionId, int segmentId) Notify the id of required segment from consumer.- Parameters:
subpartitionId- The id of the corresponding subpartition.segmentId- The id of required segment.
-
resumeConsumption
void resumeConsumption()Resumes data consumption after an exactly once checkpoint. -
acknowledgeAllRecordsProcessed
void acknowledgeAllRecordsProcessed()Acknowledges all the user records are processed. -
getAvailabilityAndBacklog
ResultSubpartitionView.AvailabilityWithBacklog getAvailabilityAndBacklog()Checks whether this reader is available or not and returns the backlog at the same time.- Returns:
- A boolean flag indicating whether the reader is available together with the backlog.
-
isRegisteredAsAvailable
boolean isRegisteredAsAvailable() -
setRegisteredAsAvailable
void setRegisteredAsAvailable(boolean isRegisteredAvailable) Updates the value to indicate whether the reader is enqueued in the pipeline or not.- Parameters:
isRegisteredAvailable- True if this reader is already enqueued in the pipeline.
-
isReleased
boolean isReleased() -
releaseAllResources
- Throws:
IOException
-
getFailureCause
Throwable getFailureCause() -
getReceiverId
InputChannelID getReceiverId() -
notifyNewBufferSize
void notifyNewBufferSize(int newBufferSize) -
notifyPartitionRequestTimeout
When the partition request from the given downstream task is timeout, it should notify the reader in netty server and sendPartitionNotFoundExceptionto the task.- Parameters:
partitionRequestListener- the timeout message of givenPartitionRequestListener
-