feat(storage): add arguments for *GenerationMatch uploading options#111
Merged
frankyn merged 7 commits intogoogleapis:masterfrom Apr 22, 2020
Merged
feat(storage): add arguments for *GenerationMatch uploading options#111frankyn merged 7 commits intogoogleapis:masterfrom
frankyn merged 7 commits intogoogleapis:masterfrom
Conversation
4 tasks
crwilcox
approved these changes
Apr 22, 2020
|
👍 Thanks to @HollayHorvath and @frankyn! The code to create a directory placeholder changes from blob = bucket.blob(name)
if not blob.exists():
blob.upload_from_string(b'', content_type=OCTET_STREAM)to blob = bucket.blob(name)
try:
blob.upload_from_string(
b'', content_type=OCTET_STREAM, if_generation_match=0)
except PreconditionFailed:
passbecause, as the doc says, "Setting to 0 makes the operation succeed only if there are no live versions of the blob." In a handful of timings, the new code saved more than half the didn't-exist time and a bit of the already-exists time (although that might be measurement noise). |
cojenco
pushed a commit
to cojenco/python-storage
that referenced
this pull request
Oct 13, 2021
…oogleapis#111) * feat(storage): add arguments for *GenerationMatch uploading options * add unit tests changes * change args names in unit tests * add unit tests for _do_multipart_upload() * add unit tests for _initiate_resumable_upload() * add args translation into unit tests urls * update args docs
cojenco
pushed a commit
to cojenco/python-storage
that referenced
this pull request
Oct 13, 2021
…oogleapis#111) * feat(storage): add arguments for *GenerationMatch uploading options * add unit tests changes * change args names in unit tests * add unit tests for _do_multipart_upload() * add unit tests for _initiate_resumable_upload() * add args translation into unit tests urls * update args docs
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.
These changes were originally made in another PR. Here is the version with changes requested by reviews.
Closes #16