-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance optimization Updates (#728)
Co-authored-by: Waqar Ahmed Khan <[email protected]>
- Loading branch information
Showing
21 changed files
with
936 additions
and
119 deletions.
There are no files selected for viewing
Submodule aws-c-auth
updated
4 files
+1 −0 | include/aws/auth/private/aws_signing.h | |
+1 −0 | include/aws/auth/signing_config.h | |
+41 −19 | source/aws_signing.c | |
+25 −0 | source/signing_config.c |
Submodule aws-c-s3
updated
30 files
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
28 changes: 28 additions & 0 deletions
28
src/main/java/software/amazon/awssdk/crt/s3/S3ExpressCredentialsProperties.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,28 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
package software.amazon.awssdk.crt.s3; | ||
|
||
public class S3ExpressCredentialsProperties { | ||
private String hostValue; | ||
private String region; | ||
|
||
public S3ExpressCredentialsProperties withHostValue (String hostValue) { | ||
this.hostValue = hostValue; | ||
return this; | ||
} | ||
|
||
public String getHostValue () { | ||
return this.hostValue; | ||
} | ||
|
||
public S3ExpressCredentialsProperties withRegion (String region) { | ||
this.region = region; | ||
return this; | ||
} | ||
|
||
public String getRegion () { | ||
return this.region; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/software/amazon/awssdk/crt/s3/S3ExpressCredentialsProvider.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,39 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
package software.amazon.awssdk.crt.s3; | ||
|
||
import software.amazon.awssdk.crt.auth.credentials.Credentials; | ||
|
||
/** | ||
* The Java object for Native code to invoke. | ||
*/ | ||
public class S3ExpressCredentialsProvider { | ||
|
||
private S3ExpressCredentialsProviderHandler handler; | ||
|
||
public S3ExpressCredentialsProvider(S3ExpressCredentialsProviderHandler handler) { | ||
this.handler = handler; | ||
} | ||
|
||
public void getS3ExpressCredentials(S3ExpressCredentialsProperties properties, Credentials origCredentials, long nativeHandler) { | ||
handler.getS3ExpressCredentials(properties, origCredentials).whenComplete((result, ex) -> { | ||
if(ex != null) { | ||
s3expressCredentialsProviderGetCredentialsCompleted(nativeHandler, null); | ||
} else { | ||
s3expressCredentialsProviderGetCredentialsCompleted(nativeHandler, result); | ||
} | ||
}); | ||
} | ||
|
||
public void destroyProvider() throws Exception { | ||
/* Block until handler finishes shutdown. It doesn't matter to wait for shutdown */ | ||
this.handler.destroyProvider().get(); | ||
} | ||
|
||
/******************************************************************************* | ||
* native methods | ||
******************************************************************************/ | ||
private static native void s3expressCredentialsProviderGetCredentialsCompleted(long nativeHandler, Credentials credentials); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/software/amazon/awssdk/crt/s3/S3ExpressCredentialsProviderFactory.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,19 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
package software.amazon.awssdk.crt.s3; | ||
|
||
|
||
public interface S3ExpressCredentialsProviderFactory { | ||
/** | ||
* A handler to create a S3ExpressCredentialsProvider for the client to use. | ||
* | ||
* Warning: | ||
* You cannot use the client while creating the provider | ||
* (You can use the client for fetching credentials) | ||
* @param client The S3Client creates and owns the provider. | ||
* @return S3ExpressCredentialsProvider created. | ||
*/ | ||
public S3ExpressCredentialsProvider createS3ExpressCredentialsProvider(S3Client client); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/software/amazon/awssdk/crt/s3/S3ExpressCredentialsProviderHandler.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,30 @@ | ||
/** | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
package software.amazon.awssdk.crt.s3; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
import software.amazon.awssdk.crt.auth.credentials.Credentials; | ||
|
||
/** | ||
* Interface to override the S3Express Credentials provider. | ||
*/ | ||
public interface S3ExpressCredentialsProviderHandler { | ||
/** | ||
* To resolve the S3Express Credentials. Invoked when a single request needs to be signed. | ||
* | ||
* @param properties The properties needed to derive the S3Express credentials from. | ||
* @param origCredentials The original Credentials for fetching S3Express credentials. | ||
* @return The future to be resolved when the S3 Express credentials are resolved. | ||
*/ | ||
public CompletableFuture<Credentials> getS3ExpressCredentials(S3ExpressCredentialsProperties properties, Credentials origCredentials); | ||
|
||
/** | ||
* Invoked when the S3 client starts to destroy to clean up related resource. | ||
* | ||
* @return The future to be resolved when the resource finishes cleaning up. | ||
*/ | ||
public CompletableFuture<Void> destroyProvider(); | ||
} |
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
Oops, something went wrong.