Package org.apache.druid.frame.channel
Interface WritableFrameChannel
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ComposingWritableFrameChannel,WritableFrameFileChannel
Interface for writing a sequence of frames. 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.-
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.frame.channel.FrameWithPartition)is able to receive a new frame without blocking or throwing an exception.voidwrite(FrameWithPartition frameWithPartition) Writes a frame with an attached partition number.default voidWrites a frame without an attached partition number.
-
Method Details
-
write
Writes a frame with an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
write
Writes a frame without an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
fail
- Parameters:
cause- optional cause of failure. Used by the in-memory channelto propagate exeptions to downstream processors. Most other channels ignore the provided cause.invalid reference
BlockingQueueFrameChannel.Writable- 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.frame.channel.FrameWithPartition),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.frame.channel.FrameWithPartition)is able to receive a new frame without blocking or throwing an exception. The future never resolves to an exception.
-