This is a proposal to add a new method abort() to the com.google.cloud.WriteChannel interface (and probably to com.google.cloud.ReadChannel)
Justification:
WriteChannel implies scenarios when sent data are buffered and flushed only when the close() method is called. If something unplanned happens in the middle, this interface doesn't allow it to close the channel without flushing the collected data. Look at the example:
try (WriteChannel writer = storage.writer(blobInfo)) {
while (someCondition) {
...
writer.write(data);
...
}
if (somethingWentWrong) {
// how to tell close() to not flush the data?
}
} // channel will be closed here
abort() would handle this case elegantly.
The request for abort() came from the Storage to support the aborting of resumable upload.
Storage-202,
Storage-1232
Perhaps, other components need this functionality as well.
Please consider including abort() in the WriteChannel interface.
Reactions are currently unavailable
This is a proposal to add a new method abort() to the com.google.cloud.WriteChannel interface (and probably to com.google.cloud.ReadChannel)
Justification:
WriteChannel implies scenarios when sent data are buffered and flushed only when the close() method is called. If something unplanned happens in the middle, this interface doesn't allow it to close the channel without flushing the collected data. Look at the example:
try (WriteChannel writer = storage.writer(blobInfo)) { while (someCondition) { ... writer.write(data); ... } if (somethingWentWrong) { // how to tell close() to not flush the data? } } // channel will be closed hereabort() would handle this case elegantly.
The request for abort() came from the Storage to support the aborting of resumable upload.
Storage-202,
Storage-1232
Perhaps, other components need this functionality as well.
Please consider including abort() in the WriteChannel interface.