Package org.apache.druid.storage.remote
Class ChunkingStorageConnector<T>
java.lang.Object
org.apache.druid.storage.remote.ChunkingStorageConnector<T>
- All Implemented Interfaces:
StorageConnector
An abstract implementation of the storage connectors that download the file from the remote storage in chunks
and presents the downloaded chunks as a single
InputStream for the consumers of the connector.
This implementation benefits over keeping the InputStream to the remote source open since we don't require the
connection to be open for the entire duration.
Checkout ChunkingStorageConnectorParameters to see the inputs required to support chunking-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ChunkingStorageConnectorParameters<T>buildInputParams(String path) abstract ChunkingStorageConnectorParameters<T>buildInputParams(String path, long from, long size) Reads the data present at the path in the underlying storage system.Reads the data present for a given range at the path in the underlying storage system.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.storage.StorageConnector
deleteFile, deleteFiles, deleteRecursively, listDir, pathExists, write
-
Constructor Details
-
ChunkingStorageConnector
public ChunkingStorageConnector() -
ChunkingStorageConnector
public ChunkingStorageConnector(long chunkSizeBytes)
-
-
Method Details
-
read
Description copied from interface:StorageConnectorReads the data present at the path in the underlying storage system. Most implementations prepend the input path with a basePath. The caller should take care of closing the stream when done or in case of error.- Specified by:
readin interfaceStorageConnector- Returns:
- InputStream
- Throws:
IOException- if the path is not present or the unable to read the data present on the path.
-
readRange
Description copied from interface:StorageConnectorReads the data present for a given range at the path in the underlying storage system. Most implementations prepend the input path with a basePath. The caller should take care of closing the stream when done or in case of error. Further, the caller must ensure that the start offset and the size of the read are valid parameters for the given path for correct behavior.- Specified by:
readRangein interfaceStorageConnector- Parameters:
path- The path to read data fromfrom- Start offset of the read in the pathsize- Length of the read to be done- Returns:
- InputStream starting from the given offset limited by the given size
-
buildInputParams
public abstract ChunkingStorageConnectorParameters<T> buildInputParams(String path) throws IOException - Throws:
IOException
-
buildInputParams
public abstract ChunkingStorageConnectorParameters<T> buildInputParams(String path, long from, long size)
-