Package org.apache.druid.frame.processor
Class PartitionedOutputChannel
- java.lang.Object
-
- org.apache.druid.frame.processor.PartitionedOutputChannel
-
public class PartitionedOutputChannel extends Object
A channel which can contain multiple partitions of data. It is used bySuperSortercurrently to write multiple partitions on the same channel. The readable channel provided to the caller is an instance ofPartitionedReadableFrameChannelwhich allows the caller to open a readable channel for the desired partition.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconvertToReadOnly()Removes the reference to thewritableChannelandframeMemoryAllocatorfrom the object, making it more efficientMemoryAllocatorgetFrameMemoryAllocator()Returns the memory allocator for the writable channel.Supplier<PartitionedReadableFrameChannel>getReadableChannelSupplier()Returns the partitioned readable channel supplier of this pair.WritableFrameChannelgetWritableChannel()Returns the writable channel of this pair.PartitionedOutputChannelmapWritableChannel(Function<WritableFrameChannel,WritableFrameChannel> mapFn)static PartitionedOutputChannelpair(WritableFrameChannel writableChannel, MemoryAllocator frameMemoryAllocator, Supplier<PartitionedReadableFrameChannel> readableChannelSupplier)Creates a partitioned output channel pair.PartitionedOutputChannelreadOnly()Returns a read-only version of this instance.
-
-
-
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 producerframeMemoryAllocator- memory allocator for producer to use while writing frames to the channelreadableChannelSupplier- partitioned readable channel for consumer. May be called multiple times, so you should wrap this inSuppliers.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.
-
mapWritableChannel
public PartitionedOutputChannel mapWritableChannel(Function<WritableFrameChannel,WritableFrameChannel> mapFn)
-
readOnly
public PartitionedOutputChannel readOnly()
Returns a read-only version of this instance. Read-only versions have neithergetWritableChannel()norgetFrameMemoryAllocator(), and therefore require substantially less memory.
-
convertToReadOnly
public void convertToReadOnly()
Removes the reference to thewritableChannelandframeMemoryAllocatorfrom the object, making it more efficient
-
-