Package org.apache.druid.frame.channel
Interface WritableFrameChannel
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
ComposingWritableFrameChannel,WritableFrameFileChannel
public interface WritableFrameChannel extends Closeable
Interface for writing a sequence of frames. Supports nonblocking writes through thewritabilityFuture()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
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()Finish writing to this channel.voidfail(Throwable cause)Called prior toclose()if the writer has failed.booleanisClosed()Whetherclose()has been called on this channel.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.voidwrite(FrameWithPartition frameWithPartition)Writes a frame with an attached partition number.default voidwrite(Frame frame)Writes a frame without an attached partition number.
-
-
-
Method Detail
-
write
void write(FrameWithPartition frameWithPartition) throws IOException
Writes a frame with an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
write
default void write(Frame frame) throws IOException
Writes a frame without an attached partition number. May throw an exception ifwritabilityFuture()is unresolved.- Throws:
IOException
-
fail
void fail(@Nullable Throwable cause) throws IOException
- 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
void close() throws IOExceptionFinish 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.
-
-