Skip to content
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

[TM DownloadDirectory Part1] Create POJO classes for download directory #2993

Merged

Conversation

zoewangg
Copy link
Contributor

Motivation and Context

Modifications

[TM DownloadDirectory Part1] Create POJO classes for download directory. Implementations will be in a separate PR.
Changes will be merged to a feature branch for now once approved.

Testing

Added unit tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@zoewangg zoewangg requested a review from a team as a code owner January 26, 2022 20:59
@zoewangg zoewangg changed the title Create POJO classes for download directory [TM DownloadDirectory Part1] Create POJO classes for download directory Jan 26, 2022
Comment on lines +280 to +281
* Download all objects under a specific prefix and bucket to the provided directory. By default, all objects in the entire
* bucket will be downloaded.
Copy link
Contributor Author

@zoewangg zoewangg Jan 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More documentation around behaviors such as whether we require the directory to pre-exist or not will be added as we start to work on implementation.

Comment on lines +45 to +47
public Collection<FailedFileDownload> failedTransfers() {
return failedTransfers;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion, non-blocking: IMO, it's more polite to return the most concrete abstract type, e.g. List instead of Collection here so that people can have constant-time random access to its members. I know that's controversial "because order doesn't matter" here, but I think it's more likely that a user would want to use failedTransfers().get(n) to get the n'th failure than a user would get confused about the order being "inconsistent" just because we returned a List instead of a Collection.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, @Bennett-Lynch and I had the same debate before! We can definitely open the discussion. The main reason I think Collection is better because it gives us flexibility to change the implementation (although it's very unlikely we will change it).
I think customers can still do failedFileUploads.stream().collect(Collectors.toList()) if they want to iterate the list by index.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you've already convinced Bennett that this is the correct decision, then I don't want to make you have to debate this again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was pro-List as well, and still somewhat am, but was mostly persuaded to use Collection since it allows us to use our ConcurrentLinkedQueue directly. I agree that ordering doesn't strictly matter here, but it still seems like a nice-to-have.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@millems Everyone's opinion matters! Let's vote on it. :)
@Bennett-Lynch We are still copying it to an ArrayList technically.

Copy link
Contributor

@millems millems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two minor non-blocking comments. Sorry I didn't notice them in the first pass.

Comment on lines +94 to +96
public Optional<DownloadDirectoryOverrideConfiguration> overrideConfiguration() {
return Optional.ofNullable(overrideConfiguration);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the default could be DownloadDirectoryOverrideConfiguration.builder().build() so that callers don't have to deal with the possibility of empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently return Optional<AwsRequestOverrideConfiguration> for the request override configuration getter though

public final Optional<AwsRequestOverrideConfiguration> overrideConfiguration() {
return Optional.ofNullable(requestOverrideConfig);
}

@sonarcloud
Copy link

sonarcloud bot commented Jan 27, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

54.0% 54.0% Coverage
10.7% 10.7% Duplication

@zoewangg zoewangg merged commit ad1d782 into zoewang/tm-downloadDirectory Jan 27, 2022
@zoewangg zoewangg deleted the zoewang/tm-downloadDirectoryPart1 branch January 27, 2022 03:34
zoewangg added a commit that referenced this pull request Feb 15, 2022
* [TM DownloadDirectory Part1] Create POJO classes for download directory (#2993)

* Create POJO classes for download directory

* Address feedback

* Address comments

* A couple of minor refactoring on the S3TransferManager (#2997)

* [TM DownloadDirectory Part2] Implement download directory in transfer manager (#3010)

* Implement download directory in transfer manager

* Add more tests and address comments

* Remove create parent directories logic and add changelog entry

* [TM DownloadDirectory Part3] Various updates on downloadDirectory (#3020)

* Implement download directory in transfer manager

* Add more tests and address comments

* Remove create parent directories logic and add changelog entry

* Various updates on downloadDirectory 1. limit the number of concurrent download file 2. create nonexistent parent directories 3. normalize key if prefix is not empty

* By default, set delimiter to null to avoid potentially excessive listObjectsV2 calls

* Move async buffering logic to SdkPublisher

* Move AsyncBufferingSubscriber back to s3-tranfer-manager module and address feedback

* remove unnecessary isDelivering.set(false)
aws-sdk-java-automation added a commit that referenced this pull request Apr 23, 2024
…7b8ad058a

Pull request: release <- staging/cb91ab5c-fb9f-4124-80e7-ed07b8ad058a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants