Class PartitionedOutputChannel


  • public class PartitionedOutputChannel
    extends Object
    A channel which can contain multiple partitions of data. It is used by SuperSorter currently to write multiple partitions on the same channel. The readable channel provided to the caller is an instance of PartitionedReadableFrameChannel which allows the caller to open a readable channel for the desired partition.
    • Method Detail

      • pair

        public static PartitionedOutputChannel pair​(WritableFrameChannel writableChannel,
                                                    MemoryAllocator frameMemoryAllocator,
                                                    Supplier<PartitionedReadableFrameChannel> readableChannelSupplier)
        Creates a partitioned output channel pair.
        Parameters:
        writableChannel - writable channel for producer
        frameMemoryAllocator - memory allocator for producer to use while writing frames to the channel
        readableChannelSupplier - partitioned readable channel for consumer. May be called multiple times, so you should wrap this in Suppliers.memoize(com.google.common.base.Supplier<T>) if needed.
      • getWritableChannel

        public WritableFrameChannel getWritableChannel()
        Returns the writable channel of this pair. The producer writes to this channel. Throws ISE if the output channel is read only.
      • getFrameMemoryAllocator

        public MemoryAllocator getFrameMemoryAllocator()
        Returns the memory allocator for the writable channel. The producer uses this to generate frames for the channel. Throws ISE if the output channel is read only.
      • getReadableChannelSupplier

        public Supplier<PartitionedReadableFrameChannel> getReadableChannelSupplier()
        Returns the partitioned readable channel supplier of this pair. The consumer reads from this channel.