Class S3ARemoteObject
java.lang.Object
org.apache.hadoop.fs.s3a.prefetch.S3ARemoteObject
Encapsulates low level interactions with S3 object on AWS.
-
Constructor Summary
ConstructorsConstructorDescriptionS3ARemoteObject(S3AReadOpContext context, S3ObjectAttributes s3Attributes, ObjectInputStreamCallbacks client, S3AInputStreamStatistics streamStatistics, ChangeTracker changeTracker) Initializes a new instance of theS3ARemoteObjectclass. -
Method Summary
Modifier and TypeMethodDescriptiongetPath()Gets the path of this file.static StringgetPath(S3ObjectAttributes s3Attributes) Gets the path corresponding to the given s3Attributes.Gets an instance ofInvokerfor interacting with S3 API.Gets an instance ofS3AInputStreamStatisticsused for reporting access metrics.software.amazon.awssdk.core.ResponseInputStream<software.amazon.awssdk.services.s3.model.GetObjectResponse>openForRead(long offset, int size) Opens a section of the file for reading.longsize()Gets the size of this file.
-
Constructor Details
-
S3ARemoteObject
public S3ARemoteObject(S3AReadOpContext context, S3ObjectAttributes s3Attributes, ObjectInputStreamCallbacks client, S3AInputStreamStatistics streamStatistics, ChangeTracker changeTracker) Initializes a new instance of theS3ARemoteObjectclass.- Parameters:
context- read-specific operation context.s3Attributes- attributes of the S3 object being read.client- callbacks used for interacting with the underlying S3 client.streamStatistics- statistics about stream access.changeTracker- helps enforce change tracking policy.- Throws:
IllegalArgumentException- if context is null.IllegalArgumentException- if s3Attributes is null.IllegalArgumentException- if client is null.IllegalArgumentException- if streamStatistics is null.IllegalArgumentException- if changeTracker is null.
-
-
Method Details
-
getReadInvoker
Gets an instance ofInvokerfor interacting with S3 API.- Returns:
- an instance of
Invokerfor interacting with S3 API.
-
getStatistics
Gets an instance ofS3AInputStreamStatisticsused for reporting access metrics.- Returns:
- an instance of
S3AInputStreamStatisticsused for reporting access metrics.
-
getPath
Gets the path of this file.- Returns:
- the path of this file.
-
getPath
Gets the path corresponding to the given s3Attributes.- Parameters:
s3Attributes- attributes of an S3 object.- Returns:
- the path corresponding to the given s3Attributes.
-
size
public long size()Gets the size of this file. Its value is cached once obtained from AWS.- Returns:
- the size of this file.
-
openForRead
public software.amazon.awssdk.core.ResponseInputStream<software.amazon.awssdk.services.s3.model.GetObjectResponse> openForRead(long offset, int size) throws IOException Opens a section of the file for reading.- Parameters:
offset- Start offset (0 based) of the section to read.size- Size of the section to read.- Returns:
- an
InputStreamcorresponding to the given section of this file. - Throws:
IOException- if there is an error opening this file section for reading.IllegalArgumentException- if offset is negative.IllegalArgumentException- if offset is greater than or equal to file size.IllegalArgumentException- if size is greater than the remaining bytes.
-