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 bySuperSorter
currently to write multiple partitions on the same channel. The readable channel provided to the caller is an instance ofPartitionedReadableFrameChannel
which 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 void
convertToReadOnly()
Removes the reference to thewritableChannel
andframeMemoryAllocator
from the object, making it more efficientMemoryAllocator
getFrameMemoryAllocator()
Returns the memory allocator for the writable channel.Supplier<PartitionedReadableFrameChannel>
getReadableChannelSupplier()
Returns the partitioned readable channel supplier of this pair.WritableFrameChannel
getWritableChannel()
Returns the writable channel of this pair.PartitionedOutputChannel
mapWritableChannel(Function<WritableFrameChannel,WritableFrameChannel> mapFn)
static PartitionedOutputChannel
pair(WritableFrameChannel writableChannel, MemoryAllocator frameMemoryAllocator, Supplier<PartitionedReadableFrameChannel> readableChannelSupplier)
Creates a partitioned output channel pair.PartitionedOutputChannel
readOnly()
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 thewritableChannel
andframeMemoryAllocator
from the object, making it more efficient
-
-