feat(storage): add deleteSourceObjects option to combine/compose method#8444
Open
thiyaguk09 wants to merge 5 commits into
Open
feat(storage): add deleteSourceObjects option to combine/compose method#8444thiyaguk09 wants to merge 5 commits into
thiyaguk09 wants to merge 5 commits into
Conversation
…ntroduce ComposeCleanupError for failed source deletions
…te delete options interface
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new deleteSourceObjects option for the combine operation in the Bucket class, allowing for the automatic deletion of source objects after a successful compose operation. It also adds a ComposeCleanupError class to handle partial failures during this cleanup process. The review feedback highlights critical safety and robustness concerns regarding potential data loss and concurrent deletion issues, suggesting the use of ifGenerationMatch and ignoreNotFound: true in the delete calls, along with corresponding updates to the test suite.
… and ignore missing sources during deletion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a client-side workaround for the
deleteSourceObjectsparameter in the GCS Compose API (combinemethod).Key Changes
deleteSourceObjects?: booleantoCombineOptionsand documented it in thecombinemethod JSDocs.deleteSourceObjectsto the JSON request body of the/composerequest (omitted ifundefinedto ensure backward compatibility and clean requests).deleteSourceObjectsis set totrueand the compose operation is successful, programmatically deletes all source files.ComposeCleanupError):ComposeCleanupErrorclass.ComposeCleanupErroris thrown/returned.errors) and attaches the newly composed file (newFile) and rawapiResponseso they are still accessible to the caller.test/bucket.tsverifying all success, failure, and partial cleanup error conditions.Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕