-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor integration for s3aseekablestream
Dummy
- Loading branch information
Showing
6 changed files
with
119 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/S3SeekableInputStreamFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package org.apache.hadoop.fs.s3a.impl.streams; | ||
Check failure on line 1 in hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/S3SeekableInputStreamFactory.java ASF Cloudbees Jenkins ci-hadoop / Apache Yetushadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/streams/S3SeekableInputStreamFactory.java#L1
|
||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.hadoop.fs.s3a.S3ASeekableStream; | ||
import org.apache.hadoop.fs.s3a.prefetch.S3APrefetchingInputStream; | ||
import software.amazon.awssdk.services.s3.S3AsyncClient; | ||
import software.amazon.s3.analyticsaccelerator.S3SdkObjectClient; | ||
import software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamConfiguration; | ||
import software.amazon.s3.analyticsaccelerator.common.ConnectorConfiguration; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.apache.hadoop.fs.s3a.Constants.*; | ||
import static org.apache.hadoop.util.Preconditions.checkState; | ||
|
||
public class S3SeekableInputStreamFactory extends AbstractObjectInputStreamFactory { | ||
|
||
S3AsyncClient s3AsyncClient; | ||
software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory s3SeekableInputStreamFactory; | ||
|
||
public S3SeekableInputStreamFactory(S3AsyncClient s3AsyncClient) { | ||
super("S3SeekableInputStreamFactory"); | ||
this.s3AsyncClient = s3AsyncClient; | ||
} | ||
|
||
@Override | ||
protected void serviceInit(final Configuration conf) throws Exception { | ||
super.serviceInit(conf); | ||
ConnectorConfiguration configuration = new ConnectorConfiguration(conf, | ||
ANALYTICS_ACCELERATOR_CONFIGURATION_PREFIX); | ||
S3SeekableInputStreamConfiguration seekableInputStreamConfiguration = | ||
S3SeekableInputStreamConfiguration.fromConfiguration(configuration); | ||
this.s3SeekableInputStreamFactory = | ||
new software.amazon.s3.analyticsaccelerator.S3SeekableInputStreamFactory( | ||
new S3SdkObjectClient(this.s3AsyncClient), | ||
seekableInputStreamConfiguration); | ||
} | ||
|
||
@Override | ||
public ObjectInputStream readObject(final ObjectReadParameters parameters) throws IOException { | ||
return new S3ASeekableStream( | ||
parameters, | ||
s3SeekableInputStreamFactory); | ||
} | ||
|
||
/** | ||
* Get the number of background threads required for this factory. | ||
* @return the count of background threads. | ||
*/ | ||
@Override | ||
public StreamThreadOptions threadRequirements() { | ||
throw new UnsupportedOperationException("This method is not supported"); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters