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

chore: Improve S3WritableByteChannel coverage, behaviour, maintenance #296

Merged
merged 15 commits into from
Nov 13, 2023

Conversation

guicamest
Copy link
Contributor

Description of changes:

This PR includes several unit tests for S3WritableByteChannel and S3TransferUtil (new class), as well as some integration tests that use Files.write. In order to ease testing and complexity, the download / upload behaviour from S3WritableByteChannel has been delegated to S3TransferUtil.

Additionally, now when S3WritableByteChannel is close()d, the temporary file is attempted to be deleted. This should help when writing multiple large files (disk space is freed after each file is copied).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

… invoked with option `CREATE_NEW` should throw FileAlreadyExistsException`
…uctor is invoked without option `CREATE_NEW` nor `CREATE` should throw NoSuchFileException`
…can be instantiated when file exists? and open options are`
@@ -1,13 +1,7 @@
package software.amazon.nio.spi.s3;

import org.slf4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not needed for this PR but I would like to add a checker/ nullness annotations to the library. Can we add checker to the gradle buid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! The annotations are already present (via some transitive dependency). NonNull is also used in ReadAheadByteChannel if I recall correctly. Do you mind creating an issue for it? It'd be nice to know whether it is just adding the dependency explicitly or integrate the checks on the build via the checkers plugin (and what checks to include)


import static java.nio.file.StandardOpenOption.CREATE;
import static java.nio.file.StandardOpenOption.READ;
import static java.nio.file.StandardOpenOption.WRITE;
Copy link
Contributor

Choose a reason for hiding this comment

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

Another todo (for another PR) would be to add a style template so we are consistent about import order, format etc. Currently I am just using IDEAs defaults but a common template would be great.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree! Do you have any library already in mind?

@markjschreiber markjschreiber merged commit 342b0d1 into awslabs:main Nov 13, 2023
1 check passed
@guicamest guicamest deleted the writableByteChannel branch November 13, 2023 17:26
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.

2 participants