-
Notifications
You must be signed in to change notification settings - Fork 77
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe 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 commentThe 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. |
||
throw new IllegalArgumentException("channel is not created by Storage"); | ||
} | ||
BlobWriteChannel blobWriteChannel = (BlobWriteChannel) channel; | ||
blobWriteChannel.cancelUpload(); | ||
} | ||
|
||
private BlobWriteChannel writer(BlobInfo blobInfo, BlobTargetOption... options) { | ||
final Map<StorageRpc.Option, ?> optionsMap = optionMap(blobInfo, options); | ||
return new BlobWriteChannel(getOptions(), blobInfo, optionsMap); | ||
|
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?