You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for batch requests in gcloud.storage #15
I think we would end up implementing this by subclassing Connection, overriding api_request such that it stored params for non-idempotent HTTP requests (anything other than GET) (similar to the Transaction's mutation in datastore).
I don't know how it should handle interleaving reads: write-after-read can lead to inconsistent state without some help from the server to isolate other changes.
Another approach would be to use a pattern like #352, where the context manager hooks api_request to defer the writes.
Add storage.batch.Batch, paralleling datastore.batch.Batch, and exposing the same methods as storage.connection.Connection. This class will "store up" the mutations and generate the multipart/mixed payload defined in Sending Batch Requests. As with the datastore variant, this Batch should be usable as a context manager, as well as in "imperative" mode (where it will need to be passed into the buckets as their connection?). #15: Add storage.batch.Batch #654
Update storage.api to look first for the active batch, falling back to the implied default connection.
@tseaver I checked and verified that GET requests can be sent as part of batch requests.
In order to accommodate this, we'd need to create a container object (maybe called Future, as in ndb) that we could hold onto and then populate when the batch returns.
Activity
tseaver commentedon Nov 7, 2014
Is there a server-side API feature that this issue refers to?
silvolu commentedon Nov 7, 2014
https://cloud.google.com/storage/docs/json_api/v1/how-tos/batch
Not sure if apitools helps with this.
tseaver commentedon Nov 7, 2014
Cool, I had missed that doc.
silvolu commentedon Nov 7, 2014
It's kinda easy to get lost in the Cloud Encyclopedia :D
tseaver commentedon Nov 8, 2014
I think we would end up implementing this by subclassing
Connection, overridingapi_requestsuch that it stored params for non-idempotent HTTP requests (anything other thanGET) (similar to theTransaction'smutationindatastore).I don't know how it should handle interleaving reads: write-after-read can lead to inconsistent state without some help from the server to isolate other changes.
Another approach would be to use a pattern like #352, where the context manager hooks
api_requestto defer the writes.tseaver commentedon Feb 12, 2015
OK, here's a plan:
datastore.batch._Batches(which is just a thread-local stack) up togcloud._localstack. Move the 'thread-local stack' implementation up from datastore. #622storage.batch.Batch, parallelingdatastore.batch.Batch, and exposing the same methods asstorage.connection.Connection. This class will "store up" the mutations and generate themultipart/mixedpayload defined in Sending Batch Requests. As with thedatastorevariant, thisBatchshould be usable as a context manager, as well as in "imperative" mode (where it will need to be passed into the buckets as their connection?). #15: Addstorage.batch.Batch#654storage.apito look first for the active batch, falling back to the implied default connection.Bucket.__init__()to look first for the active batch, but fall back (per ShouldBlobandBucketconstructors fall back to_implicit_environdefaults? #621).dhermes commentedon Feb 12, 2015
SGTM.
Merge pull request #654 from tseaver/15-add_storage_batch
tseaver commentedon Feb 26, 2015
@dhermes, I'll hold off on the third point until your work on #632 clarifies (I think we would be stepping all over each other there).
dhermes commentedon Feb 26, 2015
OK cool. I sent the first PR of the oncoming flood (I haven't written the flood yet, I just know it's coming).
dhermes commentedon Mar 9, 2015
@tseaver I checked and verified that
GETrequests can be sent as part of batch requests.In order to accommodate this, we'd need to create a container object (maybe called
Future, as inndb) that we could hold onto and then populate when the batch returns.For example:
103 remaining items
chore: start tracking obsolete files (#15)
chore: detect samples tests in nested directories (#15)
chore: add default CODEOWNERS (#15)
Refactor the wrap filter. (#15)
Add renovate.json (#15)
[chore] Version bump to 0.3.0. (#15)
fix: map LRO errors to library exception types (#86)
Merge pull request #15 from shopkick/fix_autogenerated_metrics
feat: add quota_project, credentials file, and scopes options (#15)
Chore: fix missing changes (#15)
chore: update noxfile (#15)
docs: README.md improvements (#15)
feat: add default schema name (#15)
refactor: remove unnecessary import (#15)
docs: README.md improvements (#15)