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

feat: Add abort() to writer #460

Closed
wants to merge 1 commit into from
Closed

Conversation

dmitry-fa
Copy link
Contributor

Fixes googleapis/java-core#202
The current implementation is not elegant, because one has to call storage.abort(writer) to cancel resumable upload.
Once googleapis/google-cloud-java#9101 is implemented (I hope it will be implemented sooner or later), we need just to rename private cancelUpload() method of BlobWriteChannel to public void abort().

@google-cla
Copy link

google-cla bot commented Aug 10, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added the cla: no This human has *not* signed the Contributor License Agreement. label Aug 10, 2020
@codecov
Copy link

codecov bot commented Aug 10, 2020

Codecov Report

Merging #460 into master will decrease coverage by 0.57%.
The diff coverage is 10.86%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     googleapis/java-core#460      +/-   ##
============================================
- Coverage     63.25%   62.68%   -0.58%     
+ Complexity      622      615       -7     
============================================
  Files            32       32              
  Lines          5144     5180      +36     
  Branches        491      479      -12     
============================================
- Hits           3254     3247       -7     
- Misses         1726     1765      +39     
- Partials        164      168       +4     
Impacted Files Coverage Δ Complexity Δ
...ava/com/google/cloud/storage/BlobWriteChannel.java 63.51% <0.00%> (-11.09%) 10.00 <0.00> (ø)
...rc/main/java/com/google/cloud/storage/Storage.java 80.64% <ø> (ø) 0.00 <0.00> (ø)
...om/google/cloud/storage/spi/v1/HttpStorageRpc.java 1.55% <0.00%> (-0.05%) 2.00 <0.00> (ø)
...ogle/cloud/storage/spi/v1/HttpStorageRpcSpans.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...va/com/google/cloud/storage/spi/v1/StorageRpc.java 66.23% <ø> (ø) 0.00 <0.00> (ø)
...ogle/cloud/storage/testing/StorageRpcTestBase.java 94.11% <0.00%> (-1.89%) 48.00 <0.00> (ø)
...ain/java/com/google/cloud/storage/StorageImpl.java 81.02% <100.00%> (+0.02%) 140.00 <2.00> (-7.00) ⬆️
...in/java/com/google/cloud/storage/StorageBatch.java 88.00% <0.00%> (-4.00%) 13.00% <0.00%> (ø%)
...main/java/com/google/cloud/storage/BucketInfo.java 81.69% <0.00%> (-0.32%) 86.00% <0.00%> (ø%)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8d6e15...257317d. Read the comment docs.

@google-cla google-cla bot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Aug 10, 2020
@dmitry-fa dmitry-fa requested a review from frankyn August 10, 2020 17:08
@dmitry-fa
Copy link
Contributor Author

New tests covering RPC code will be added after #454 is merged.

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/java-storage API. label Aug 21, 2020
@@ -696,6 +696,15 @@ public BlobWriteChannel writer(URL signedURL) {
return new BlobWriteChannel(getOptions(), signedURL);
}

@Override
public void abort(WriteChannel channel) {
if (!(channel instanceof BlobWriteChannel)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

why not make the method argument a BlobWriteChannel then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@elharo BlobWriteChannel is a package-private class. If it were public we could invoke channel.abort() directly.

@@ -21,6 +21,16 @@
<method>com.google.cloud.storage.BucketInfo$Builder deleteLifecycleRules()</method>
<differenceType>7013</differenceType>
</difference>
<difference>
Copy link
Contributor

Choose a reason for hiding this comment

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

Yet again, we're getting stuck because of excessive use of interfaces. Either there are multiple implementations of Storage and we shouldn't make this change or we should bite the bullet and combine Storage and StorageImpl once and for all. Ditto StorageRpc and HttpStorageRpc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@frankyn what do you think about combining Storage and StorageImpl?

@frankyn frankyn closed this Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add abort() to writer
3 participants