Class HsSubpartitionConsumerMemoryDataManager

    • Constructor Detail

      • HsSubpartitionConsumerMemoryDataManager

        public HsSubpartitionConsumerMemoryDataManager​(Lock resultPartitionLock,
                                                       Lock consumerLock,
                                                       int subpartitionId,
                                                       HsConsumerId consumerId,
                                                       HsMemoryDataManagerOperation memoryDataManagerOperation)
    • Method Detail

      • consumeBuffer

        public Optional<ResultSubpartition.BufferAndBacklog> consumeBuffer​(int toConsumeIndex,
                                                                           Collection<Buffer> buffersToRecycle)
        Check whether the head of unConsumedBuffers is the buffer to be consumed. If so, return the buffer and backlog.
        Specified by:
        consumeBuffer in interface HsDataView
        Parameters:
        toConsumeIndex - index of buffer to be consumed.
        buffersToRecycle - buffers to recycle if needed.
        Returns:
        If the head of unConsumedBuffers is target, return optional of the buffer and backlog. Otherwise, return Optional.empty().
      • peekNextToConsumeDataType

        public Buffer.DataType peekNextToConsumeDataType​(int nextToConsumeIndex,
                                                         Collection<Buffer> buffersToRecycle)
        Check whether the head of unConsumedBuffers is the buffer to be consumed next time. If so, return the next buffer's data type.
        Specified by:
        peekNextToConsumeDataType in interface HsDataView
        Parameters:
        nextToConsumeIndex - index of the buffer to be consumed next time.
        buffersToRecycle - buffers to recycle if needed.
        Returns:
        If the head of unConsumedBuffers is target, return the buffer's data type. Otherwise, return Buffer.DataType.NONE.
      • getBacklog

        public int getBacklog()
        Description copied from interface: HsDataView
        Get the number of buffers whose Buffer.DataType is buffer.
        Specified by:
        getBacklog in interface HsDataView
        Returns:
        backlog of this view's corresponding subpartition.