Interface BufferProvider

  • All Superinterfaces:
    AvailabilityProvider
    All Known Subinterfaces:
    BufferPool
    All Known Implementing Classes:
    LocalBufferPool

    public interface BufferProvider
    extends AvailabilityProvider
    A buffer provider to request buffers from in a synchronous or asynchronous fashion.

    The data producing side (result partition writers) request buffers in a synchronous fashion, whereas the input side requests asynchronously.

    • Method Detail

      • requestBuffer

        @Nullable
        Buffer requestBuffer()
        Returns a Buffer instance from the buffer provider, if one is available.
        Returns:
        null if no buffer is available or the buffer provider has been destroyed.
      • requestBufferBuilder

        @Nullable
        BufferBuilder requestBufferBuilder()
        Returns a BufferBuilder instance from the buffer provider. This equals to requestBufferBuilder(int) with unknown target channel.
        Returns:
        null if no buffer is available or the buffer provider has been destroyed.
      • requestBufferBuilder

        @Nullable
        BufferBuilder requestBufferBuilder​(int targetChannel)
        Returns a BufferBuilder instance from the buffer provider.
        Parameters:
        targetChannel - to which the request will be accounted to.
        Returns:
        null if no buffer is available or the buffer provider has been destroyed.
      • requestBufferBuilderBlocking

        BufferBuilder requestBufferBuilderBlocking​(int targetChannel)
                                            throws InterruptedException
        Returns a BufferBuilder instance from the buffer provider.

        If there is no buffer available, the call will block until one becomes available again or the buffer provider has been destroyed.

        Parameters:
        targetChannel - to which the request will be accounted to.
        Throws:
        InterruptedException
      • addBufferListener

        boolean addBufferListener​(BufferListener listener)
        Adds a buffer availability listener to the buffer provider.

        The operation fails with return value false, when there is a buffer available or the buffer provider has been destroyed.

      • isDestroyed

        boolean isDestroyed()
        Returns whether the buffer provider has been destroyed.
      • requestMemorySegment

        @Nullable
        org.apache.flink.core.memory.MemorySegment requestMemorySegment()
        Returns a MemorySegment instance from the buffer provider.
        Returns:
        null if no memory segment is available or the buffer provider has been destroyed.
      • requestMemorySegmentBlocking

        org.apache.flink.core.memory.MemorySegment requestMemorySegmentBlocking()
                                                                         throws InterruptedException
        Returns a MemorySegment instance from the buffer provider.

        If there is no memory segment available, the call will block until one becomes available again or the buffer provider has been destroyed.

        Throws:
        InterruptedException