GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java-storage] Add abort() to writer · Issue #12653 · googleapis/google-cloud-java

[java-storage] Add abort() to writer #12653

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
[java-storage] Add abort() to writer#12653
Copy link
Labels
api: storageIssues related to the Cloud Storage API.priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@frankyn
frankyn
opened on Mar 21, 2020
Issue body actions

Feature request filed in google-cloud-java: #1232

Reacted by Jonatan Jönsson and Luís Bianchin

Activity

  1. frankyn
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Mar 21, 2020
  2. product-auto-label
    added
    api: storageIssues related to the Cloud Storage API.
    on Mar 21, 2020
  3. dmitry-fa
    self-assigned this
    on Apr 13, 2020
  4. dmitry-fa commented on May 19, 2020

    @dmitry-fa
    dmitry-fa
    on May 19, 2020
    More actions

    Hi @frankyn.

    I'd like to suggest an approach for resumable upload implementation. Before proper documenting and writing tests, I'd like to check with you if my approach is applicable.

    • extend com.google.cloud.storage.spi.v1.StorageRpc interface with
      /**
       * Aborts the given resumable upload.
       *
       * @throws StorageException upon failure
       */
      void abort(String uploadId);
    

    to send DELETE request on the given uploadId as suggested Issue-1232

    • add new method to package private class com.google.cloud.storage.BlobWriteChannel like:
    void abort() {
        getOptions().getStorageRpcV1() .abort(getUploadId());
    }
    
    • extend com.google.cloud.storage.Storage interface with:
      /**
       * Aborts resumeable upload. Further attempts to write to or close the channel will result in
       * StorageException with the code 499.
       *
       * @param channel an instance crated either by {@link #writer(BlobInfo, BlobWriteOption...)}
       *                or by {@link #writer(URL)} method.
       * @throws IllegalArgumentException if inappropriate channel is given
       * @throws StorageException upon failure
       */
      public void abort(WriteChannel channel) {
        if (!(channel instanceof BlobWriteChannel)) {
          throw new IllegalArgumentException("channel is not created by Storage");
        }
        BlobWriteChannel blobWriteChannel = (BlobWriteChannel)channel;
        blobWriteChannel.abort();
      }
    
  5. frankyn commented on Jun 24, 2020

    @frankyn
    frankyn
    on Jun 24, 2020
    ContributorAuthor
    More actions

    I wanted abort to be part of WriteChannel interface but it may not make sense for all libraries that support this interface.

    Could you review this open question?

    Changes to StorageRpc do look okay, but would make the name specific to resumable upload sessions.

    // com.google.cloud.storage.spi.v1.StorageRpc
    void abortResumableUpload(String uploadId)
  6. dmitry-fa commented on Jun 24, 2020

    @dmitry-fa
    dmitry-fa
    on Jun 24, 2020
    More actions

    @frankyn,

    I wanted abort to be part of WriteChannel interface but it may not make sense for all libraries that support this interface.

    I thought WriteChannel is a too generic interface to contain abort() method and didn't plan to extend it.
    After your words, I reviewed the spec and found interesting facts:

    • WriteChannel implements Closable
    • Implementations of this class may further buffer data internally to reduce remote calls. Written data might not be visible until calling Channel.close().

    So adding abort() will make sense to tell close() that it's not needed anymore to flush buffered data when close() method is called on the channel.

  7. frankyn commented on Jun 25, 2020

    @frankyn
    frankyn
    on Jun 25, 2020
    ContributorAuthor
    More actions

    I think you'll need to submit a proposal to the interface to see if it's acceptable to add abort(). Could you follow-up on that?

  8. dmitry-fa commented on Jun 25, 2020

    @dmitry-fa
    dmitry-fa
    on Jun 25, 2020
    More actions

    @frankyn Yes, I will work on this.

  9. dmitry-fa commented on Jun 26, 2020

    @dmitry-fa
    dmitry-fa
    on Jun 26, 2020
    More actions

    @frankyn, this is the proposal: #9101

  10. dmitry-fa commented on Oct 28, 2020

    @dmitry-fa
    dmitry-fa
    on Oct 28, 2020
    More actions

    Thoughts and suggestions:

    • Why abort is required?
      Aborting is required when the user decides in the middle of uploading that the blob should not be updated/created. Now when an instance of WriteChannel for a blob is created the close() method will be called eventually on the instance, this will cause the blob update/create. The server side already supports DELETE command on the upload URL, but this command is currently not available in the Java client.

    • How abort functionality could be added to the Java client?
      The StorageRpc interface should be extended with a new method like void abort(String uploadId). Then an abort() method should be added to the BlobWriteChannel class. The current problem is BlobWriteChannel has a package-private access and we need to decide how to make this method visible for users. Possible suggestions with pros/cons:

      • Extend global WriteChannel interface as suggested in feat: Add abort() to WriteChannel interface #9101
        +: seems the most logical solution
        -: extending interface is an incompatible change
        -: might take a while to get approval/implement
        -: could be not needed for other extensions of WriteChannel
      • Make BlobWriteChannel/BlobReaderChannel public
        +: doesn't break API
        -: exposes extra API
      • Temporary solution: declare Storage.abort(WriteChannel) method (as proposed in feat: Add abort() to writer java-storage#460)
        +: doesn't break API
        +: could be implemented quickly
        -: extends overloaded Storage interface
  11. frankyn
    unassigned
    dmitry-fa
    on Jun 3, 2021
  12. chingor13
    changed the title [-]Add abort() to writer[/-] [+][java-storage] Add abort() to writer[/+] on Apr 2, 2026
  13. chingor13
    transferred this issue fromgoogleapis/java-storageon Apr 2, 2026
  14. jjmew commented on Nov 18, 2026

    @jjmew
    jjmew
    on Nov 18, 2026
    More actions

    Closing this issue due to inactivity (no activity in over two years). If it's still relevant, please feel free to reopen it or comment with any additional information, such as the library version and steps to reproduce. Thank you!

  15. jjmew
    closed this as not plannedon Nov 18, 2026
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: p2Moderately-important priority. Fix may not be included in next release.type: 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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.