feat(storage): add deleteSourceObjects option to Bucket::compose()#9211
Conversation
|
Hi maintainers, The single This PR strictly modifies 4 files under the Since the CI workflow uses Ready for a final look and merge! |
…bjects on compose
5187dcb to
3c277b6
Compare
kalragauri
left a comment
There was a problem hiding this comment.
Please update the PR description to match the updated implementation.
| $bucket->compose(['file1.txt', 'file2.txt'], 'combined-files.abc'); | ||
| } | ||
|
|
||
|
|
Overview
This Pull Request implements support for the native GCS server-side auto-deletion of source objects when merging files using
Bucket::compose().When the option
deleteSourceObjects => trueis supplied, GCS natively handles the sequential cleanup of intermediate component files on the server-side, making the composition operation immeasurably faster, safer, and completely transaction-secure.Architecture & Design Decisions
Instead of sending
deleteSourceObjectsas a URL query parameter or running a manual client-side cleanup loop, this implementation fully integrates the option inside the JSON request body payload (ComposeRequestproperties).Completely delegates the deletion process to the GCS backend. The library makes exactly one single POST call to
objects.composewithout spawning any local deletion loops, catching errors, or making redundant connection calls.Updated the API service discovery spec (
storage-v1.json) to definedeleteSourceObjectsinside theComposeRequestbody properties, while removing it from the URL query parameters. This allows Guzzle'sRequestBuilderto naturally handle request mapping and serialization.Changes
Storage/src/Bucket.php:deleteSourceObjectsinside thecompose()method docstrings.Storage/src/Connection/ServiceDefinition/storage-v1.json:deleteSourceObjectsfrom the query parameter metadata list of theobjects.composemethod.deleteSourceObjectsas a boolean property under theComposeRequestrequest body schema.Storage/tests/Unit/BucketTest.php:deleteSourceObjects => trueinside the request body parameters.deleteObject()are spawned.Storage/tests/System/ManageObjectsTest.php:true,false,null).Verification & Testing
All unit tests have been successfully verified and pass with a 100% success rate locally:
OK (64 tests, 111 assertions)