[gcloud] Support GCS preconditions for object write/delete/copy#352
[gcloud] Support GCS preconditions for object write/delete/copy#352Amayyas wants to merge 1 commit into
Conversation
Add optional `ifGenerationMatch` and `ifMetagenerationMatch` parameters to the object write, delete, metadata update and copy operations, enabling optimistic concurrency control as described at https://cloud.google.com/storage/docs/request-preconditions. The parameter types mirror the existing `ObjectGeneration` API (`objectGeneration` is a `String`, `metaGeneration` is an `int`) so values read from `ObjectInfo.generation` can be passed straight back as preconditions without conversion. The change is purely additive and non-breaking. Fixes dart-lang#184
|
for the record, I think https://pub.dev/packages/google_cloud_storage is the future, consider giving it a try, I think it has some of these features. |
PR HealthUnused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Coverage ✔️
This check for test coverage is informational (issues shown here will not fail the PR). This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with |
|
Thanks for the pointer — I hadn't come across Reading through it, it does look like the direction of travel, but it's still marked experimental (0.6.2, under Happy to go whichever way is most useful to you:
Just let me know which you'd prefer. |
Adds optional
ifGenerationMatchandifMetagenerationMatchparameters to the object write, delete, metadata-update and copy operations, enabling optimistic concurrency control as described at https://cloud.google.com/storage/docs/request-preconditions.The parameter types mirror the existing
ObjectGenerationAPI (objectGenerationis aString,metaGenerationis anint), so a value read fromObjectInfo.generationcan be passed straight back as a precondition without conversion. AnifGenerationMatchof0(as the string'0') limits a write/copy to the case where the object does not yet exist.The change is purely additive and non-breaking.
Fixes #184