-
Notifications
You must be signed in to change notification settings - Fork 78
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
Conversation
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. ℹ️ Googlers: Go here for more info. |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
New tests covering RPC code will be added after #454 is merged. |
@@ -696,6 +696,15 @@ public BlobWriteChannel writer(URL signedURL) { | |||
return new BlobWriteChannel(getOptions(), signedURL); | |||
} | |||
|
|||
@Override | |||
public void abort(WriteChannel channel) { | |||
if (!(channel instanceof BlobWriteChannel)) { |
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.
why not make the method argument a BlobWriteChannel then?
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.
@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> |
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.
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.
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.
@frankyn what do you think about combining Storage and StorageImpl?
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 ofBlobWriteChannel
topublic void abort()
.