-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for S3TransferManager TransferListeners #2770
Merged
Merged
Conversation
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
zoewangg
reviewed
Oct 14, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still going through the PR.
...manager/src/it/java/software/amazon/awssdk/transfer/s3/ProgressPrintingTransferListener.java
Outdated
Show resolved
Hide resolved
core/annotations/src/main/java/software/amazon/awssdk/annotations/Mutable.java
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...nsfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/TransferProgressSnapshot.java
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
dagnir
reviewed
Oct 14, 2021
...ces-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/Context.java
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...m/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/TransferListener.java
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
1. Are we correct to distinguish between `ratioTransferred` vs `percentageTransferred`? Will the return value of `percentageTransferred` surprise any users? | ||
1. Should the `Context` wrapper class reside inside `TransferListener` or outside? Outside is consistent w/ `ExecutionInterceptor`'s `Context`, but prevents having 2 `Context` objects in the same package. | ||
1. Should we have a callback for when the `content-length` is discovered on a Get? | ||
1. Also provide option to declare listeners at the TM/client level? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to this, had a comment earlier on before seeing this
...-custom/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/internal/tmp.md
Outdated
Show resolved
Hide resolved
zoewangg
reviewed
Oct 19, 2021
core/annotations/src/main/java/software/amazon/awssdk/annotations/Mutable.java
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...nsfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/TransferProgressSnapshot.java
Outdated
Show resolved
Hide resolved
...nsfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/TransferProgressSnapshot.java
Outdated
Show resolved
Hide resolved
...c/main/java/software/amazon/awssdk/transfer/s3/internal/DefaultTransferProgressSnapshot.java
Outdated
Show resolved
Hide resolved
...anager/src/main/java/software/amazon/awssdk/transfer/s3/internal/TransferProgressHelper.java
Outdated
Show resolved
Hide resolved
...manager/src/it/java/software/amazon/awssdk/transfer/s3/ProgressPrintingTransferListener.java
Outdated
Show resolved
Hide resolved
Bennett-Lynch
changed the title
Add support for S3TransferManager progress listeners
Add support for S3TransferManager TransferListeners
Oct 19, 2021
This adds initial support for S3TransferManager TransferListeners. The motivation and design is consistent as outlined in aws#2729. It also addresses some customer asks as mentioned in aws#37. Every @SdkPublicApi has been thoroughly documented with its description and usage instructions where applicable.
and handle multiple calls to subscribe(..)
Bennett-Lynch
force-pushed
the
transfer-listener
branch
from
October 21, 2021 07:07
5a01982
to
4548a53
Compare
zoewangg
reviewed
Oct 21, 2021
...om/s3-transfer-manager/src/main/java/software/amazon/awssdk/transfer/s3/DownloadRequest.java
Outdated
Show resolved
Hide resolved
...nager/src/main/java/software/amazon/awssdk/transfer/s3/progress/LoggingTransferListener.java
Outdated
Show resolved
Hide resolved
...c/main/java/software/amazon/awssdk/transfer/s3/internal/DefaultTransferProgressSnapshot.java
Outdated
Show resolved
Hide resolved
zoewangg
approved these changes
Oct 21, 2021
dagnir
approved these changes
Oct 21, 2021
Kudos, SonarCloud Quality Gate passed! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Revision 4 (4548a53)
Noteworthy changes:
TransferProgress progress()
method fromTransfer
interface toUpload
/Download
, as it's not compatible withUploadDirectoryTransfer
(will review the interface hierarchy in a follow-up)upload(..)
anddownload(..)
return an object with a non-nullableTransferProgress
, it was difficult to reconcile it with the new try/catch logic that propagated every exception in the form of aCompletableFuture
. Adjusted the methods to throw to caller if we cannot instantiate aTransferProgress
, and everything else viaCompletableFuture
.CompletableFutureUtils.forwardTransformedResultTo(..)
method.Revision 3 (5a01982)
Noteworthy changes:
ProgressPrintingTransferListener
converted to public-facingLoggingTransferListener
LoggingTransferListener
'smaxTicks
configurableTransferListener
documentation with a link toLoggingTransferListener
StringUtils.repeat(..)
method (and add tests)before...
orafter...
bytesTransferred
upon re-subscribing (should not be called by current CRT implementation)software.amazon.awssdk.transfer.s3.progress
packageTransferProgressHelper
renamed toTransferProgressUpdater
List<TransferListener>
intoTransferRequestOverrideConfiguration
container classTransferProgressUpdater
constructors and stop usingOptional
transferSize
totransferSizeInBytes
Deferred for follow-up PRs or conversations:
TransferListener
s at the client-level or not. Since manyTransferListener
s are likely to be stateful, it may be counter-intuitive or error-prone to declare them at the client-level. We could accept aSupplier<TransferListener>
(i.e., factory), but there's not a strong precedent for that type of API.TransferListener
s from. Currently,transferInitiated
is invoked on the caller's thread,bytesTransferred
is invoked by CRT's delivery threads (separate from the CRT event loop), andtransferComplete
is invoked by theS3NativeClientConfiguration
'sfutureCompletionExecutor
. We should make this more consistent, but may require absorbing the recent work that added anExecutor
foruploadDirectory
.Revision 2 (7d2fe3a)
Noteworthy changes:
addListener(..)
Context
class to be an inner-class ofTransferListener
TransferListener
TransferListener
documentation to include the callback lifecycleTransferProgressSnapshot
to interfacetotalBytesTransferred()
->bytesTransferred()
totalTransferSize()
->transferSize()
totalBytesRemaining()
->bytesRemaining()
percentageTransferred()
in favor of only exposingratioTransferred()
ratioTransferred()
return 1.0 (100%) for zero-byte objectsAsyncRequestBodyListener
/AsyncResponseTransformerListener
methods withdelegated
TransferListenerInvoker
to log on behalf ofTransferListener
Unresolved:
ProgressPrintingTransferListener
private or make publicMutable
annotation or removeTransferRequestOverrideConfiguration
or justTransferRequest
TransferListener
s at the TM/client-level or only request-levelRevision 1 (9976e29)
This adds initial support for S3TransferManager progress listeners. The motivation and design is consistent as outlined in #2729. It also addresses some customer asks as mentioned in #37.
Every
@SdkPublicApi
has been thoroughly documented with its description and usage instructions where applicable.Furthermore, there is a temporary
tmp.md
file that captures some ongoing development thoughts and notes. This file will be fully addressed & deleted before merging to master.Types of changes
Checklist
mvn install
succeedsLicense