Package org.apache.druid.data.input
Interface InputEntity
- All Known Implementing Classes:
ByteEntity,BytesCountingInputEntity,FileEntity,HttpEntity,RetryingInputEntity
public interface InputEntity
InputEntity abstracts an input entity and knows how to read bytes from the given entity.
Since the implementations of this interface assume that the given entity is not empty, the InputSources
should not create InputEntities for empty entities.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceCleanableFile is the result type offetch(java.io.File, byte[]). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault InputEntity.CleanableFileFetches the input entity into the local storage.default com.google.common.base.Predicate<Throwable>Returns a retry condition that the caller should retry on.getUri()Returns an URI to identify the input entity.open()Opens anInputStreamon the input entity directly.
-
Field Details
-
LOG
-
DEFAULT_FETCH_BUFFER_SIZE
static final int DEFAULT_FETCH_BUFFER_SIZE- See Also:
-
DEFAULT_MAX_NUM_FETCH_TRIES
static final int DEFAULT_MAX_NUM_FETCH_TRIES- See Also:
-
-
Method Details
-
getUri
Returns an URI to identify the input entity. Implementations can return null if they don't have an unique URI. -
open
Opens anInputStreamon the input entity directly. This is the basic way to read the given entity. This method may be called multiple times to re-read the data from the entity.- Throws:
IOException- See Also:
-
fetch
default InputEntity.CleanableFile fetch(File temporaryDirectory, byte[] fetchBuffer) throws IOException Fetches the input entity into the local storage. This method might be preferred instead ofopen(), for example -InputFormatrequires expensive random access on remote storage. - Holding a connection until you consume the entire InputStream is expensive.- Parameters:
temporaryDirectory- to store temp data. This directory will be removed automatically once the task finishes.fetchBuffer- is used to fetch remote entity into local storage.- Throws:
IOException- See Also:
-
getRetryCondition
Returns a retry condition that the caller should retry on. The returned condition should be used when reading data from this InputEntity such as infetch(java.io.File, byte[])orRetryingInputEntity.
-