Package org.apache.druid.frame.channel
Class ReadableFileFrameChannel
java.lang.Object
org.apache.druid.frame.channel.ReadableFileFrameChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,ReadableFrameChannel
Channel backed by a
FrameFile.
This class is backed by an actual file that is on disk and memory-mapped. For situations where a stream in frame
file format is being read over the network, use ReadableByteChunksFrameChannel or
FrameFileHttpResponseHandler instead.-
Constructor Summary
ConstructorsConstructorDescriptionReadableFileFrameChannel(FrameFile frameFile, int startFrame, int endFrame, WireTransferable.ConcreteDeserializer deserializer) ReadableFileFrameChannel(FrameFile frameFile, WireTransferable.ConcreteDeserializer deserializer) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanRead()Returns whether this channel has a batch of data or error condition currently available.voidclose()Releases any resources associated with this readable channel.booleanReturns whether this channel represents the entire underlyingFrameFile.booleanReturns whether this channel is finished.Returns a new reference to theFrameFilethat this channel is reading from.read()Returns the next available batch of data from this channel as aRowsAndColumns.com.google.common.util.concurrent.ListenableFuture<?>Returns a future that will resolve when eitherReadableFrameChannel.isFinished()orReadableFrameChannel.canRead()would return true.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.frame.channel.ReadableFrameChannel
readFrame
-
Constructor Details
-
ReadableFileFrameChannel
public ReadableFileFrameChannel(FrameFile frameFile, int startFrame, int endFrame, WireTransferable.ConcreteDeserializer deserializer) -
ReadableFileFrameChannel
public ReadableFileFrameChannel(FrameFile frameFile, WireTransferable.ConcreteDeserializer deserializer)
-
-
Method Details
-
isFinished
public boolean isFinished()Description copied from interface:ReadableFrameChannelReturns whether this channel is finished. Finished channels will not generate any further data batches or errors. Generally, once you discover that a channel is finished, you should callReadableFrameChannel.close()and then discard it. Note that it is possible for a channel to be unfinished and also have no available data batches or errors. This happens when it is not in a ready-for-reading state. SeeReadableFrameChannel.readabilityFuture()for details.- Specified by:
isFinishedin interfaceReadableFrameChannel
-
canRead
public boolean canRead()Description copied from interface:ReadableFrameChannelReturns whether this channel has a batch of data or error condition currently available. If this method returns true, then you can callReadableFrameChannel.readFrame()orReadableFrameChannel.read()to retrieve the batch or error. Note that it is possible for a channel to be unfinished and also have no available batches or errors. This happens when it is not in a ready-for-reading state. SeeReadableFrameChannel.readabilityFuture()for details.- Specified by:
canReadin interfaceReadableFrameChannel
-
read
Description copied from interface:ReadableFrameChannelReturns the next available batch of data from this channel as aRowsAndColumns. Before calling this method, you should checkReadableFrameChannel.canRead()to ensure there is a batch of data or error available.- Specified by:
readin interfaceReadableFrameChannel
-
readabilityFuture
public com.google.common.util.concurrent.ListenableFuture<?> readabilityFuture()Description copied from interface:ReadableFrameChannelReturns a future that will resolve when eitherReadableFrameChannel.isFinished()orReadableFrameChannel.canRead()would return true. The future will never resolve to an exception. If something exceptional has happened, the exception can be retrieved fromReadableFrameChannel.readFrame()orReadableFrameChannel.read().- Specified by:
readabilityFuturein interfaceReadableFrameChannel
-
close
public void close()Description copied from interface:ReadableFrameChannelReleases any resources associated with this readable channel. After calling this, you should not call any other methods on the channel.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReadableFrameChannel
-
isEntireFile
public boolean isEntireFile()Returns whether this channel represents the entire underlyingFrameFile. -
newFrameFileReference
Returns a new reference to theFrameFilethat this channel is reading from. Callers should close this reference when done reading.
-