Package org.apache.druid.frame.channel
Interface WritableFrameChannel
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ComposingWritableFrameChannel,WritableFrameFileChannel
Interface for writing a sequence of result batches. Supports nonblocking writes through the
writabilityFuture() method.
May be implemented using an in-memory queue, disk file, stream, etc.
Channels implementing this interface are used by a single writer; they do not support concurrent writes.
Despite its name, instances of this class can typically accept any RowsAndColumns through the
write(RowsAndColumns) method.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPartition number used when there is no meaningful partition to associate with a batch of data. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Finish writing to this channel.voidCalled prior toclose()if the writer has failed.booleanisClosed()Whetherclose()has been called on this channel.com.google.common.util.concurrent.ListenableFuture<?>Returns a future that resolves whenwrite(org.apache.druid.query.rowsandcols.RowsAndColumns, int)is able to receive a new batch of data without blocking or throwing an exception.default voidWrites a frame without an attached partition number.default voidWrites a frame with an attached partition number.default voidwrite(RowsAndColumns rac) Writes a batch of data without an attached partition number.voidwrite(RowsAndColumns rac, int partitionNumber) Writes a batch of data with an attached partition number.
-
Field Details
-
NO_PARTITION
static final int NO_PARTITIONPartition number used when there is no meaningful partition to associate with a batch of data.- See Also:
-
-
Method Details
-
write
Writes a batch of data with an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
write
Writes a batch of data without an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
write
Writes a frame with an attached partition number. Equivalent to callingwrite(RowsAndColumns, int)withFrame.asRAC(). May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
write
Writes a frame without an attached partition number. Equivalent to callingwrite(RowsAndColumns)withFrame.asRAC(). May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
fail
- Parameters:
cause- optional cause of failure. Used by the in-memory channelBlockingQueueFrameChannel.Writableto propagate exeptions to downstream processors. Most other channels ignore the provided cause.- Throws:
IOException
-
close
Finish writing to this channel. When this method is called withoutfail(Throwable)having previously been called, the writer is understood to have completed successfully. After calling this method, no additional calls towrite(org.apache.druid.query.rowsandcols.RowsAndColumns, int),fail(Throwable), or this method are permitted.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isClosed
boolean isClosed()Whetherclose()has been called on this channel. -
writabilityFuture
com.google.common.util.concurrent.ListenableFuture<?> writabilityFuture()Returns a future that resolves whenwrite(org.apache.druid.query.rowsandcols.RowsAndColumns, int)is able to receive a new batch of data without blocking or throwing an exception. The future never resolves to an exception.
-