Package org.apache.druid.data.input
Class BytesCountingInputEntity
java.lang.Object
org.apache.druid.data.input.BytesCountingInputEntity
- All Implemented Interfaces:
InputEntity
Wrapper around an
InputEntity that counts the number of bytes read.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.data.input.InputEntity
InputEntity.CleanableFile -
Field Summary
Fields inherited from interface org.apache.druid.data.input.InputEntity
DEFAULT_FETCH_BUFFER_SIZE, DEFAULT_MAX_NUM_FETCH_TRIES, LOG -
Constructor Summary
ConstructorsConstructorDescriptionBytesCountingInputEntity(InputEntity baseInputEntity, InputStats inputStats) -
Method Summary
Modifier and TypeMethodDescriptionFetches the input entity into the local storage.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.
-
Constructor Details
-
BytesCountingInputEntity
-
-
Method Details
-
getUri
Description copied from interface:InputEntityReturns an URI to identify the input entity. Implementations can return null if they don't have an unique URI.- Specified by:
getUriin interfaceInputEntity
-
open
Description copied from interface:InputEntityOpens 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.- Specified by:
openin interfaceInputEntity- Throws:
IOException- See Also:
-
getBaseInputEntity
-
fetch
public InputEntity.CleanableFile fetch(File temporaryDirectory, byte[] fetchBuffer) throws IOException Description copied from interface:InputEntityFetches the input entity into the local storage. This method might be preferred instead ofInputEntity.open(), for example -InputFormatrequires expensive random access on remote storage. - Holding a connection until you consume the entire InputStream is expensive.- Specified by:
fetchin interfaceInputEntity- 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
Description copied from interface:InputEntityReturns a retry condition that the caller should retry on. The returned condition should be used when reading data from this InputEntity such as inInputEntity.fetch(java.io.File, byte[])orRetryingInputEntity.- Specified by:
getRetryConditionin interfaceInputEntity
-