Skip to content

feat: Add abort() to WriteChannel interface #9101

Description

@dmitry-fa

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.

Activity

  1. frankyn commented on Jun 26, 2020

    @frankyn
    Contributor

    @chingor13 what do you think about introducing abort into WriteChannel? It might be too specific, but wanted to get your thoughts on it.

  2. added
    api: storageIssues related to the Cloud Storage API.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Jun 26, 2020
  3. removed their assignment
    on Jul 26, 2022
  4. BenWhitehead commented on Feb 8, 2023

    @BenWhitehead
    Contributor

    Closing in favor of tracking via #12653

  5. suztomo commented on Feb 8, 2023

    @suztomo
    Member

    Thank you for context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: storageIssues related to the Cloud Storage API.priority: p4type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions