Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing datastore commit reliance on structure of response. #1314

Merged
merged 1 commit into from
Dec 22, 2015

Conversation

dhermes
Copy link
Contributor

@dhermes dhermes commented Dec 22, 2015

Also moving out the response parsing into a helper which can
be monkey-patched out during testing.

This is for the v1beta2 to v1beta3 change. Currently the
CommitResponse object contains a single MutationResult that holds
an integer index_updates field and a repeated field (insert_auto_id_key)
of partial Keys that were completed in the commit.

In v1beta3, the CommitResponse directly holds the integer index_updates
as well as a list of MutationResults. Additionally, the definition of
MutationResult no longer has index_updates (obviously given the last
sentence) and no longer holds a list of Keys. Instead, it holds a single
Key in the key field. What's more, the list of MutationResults
corresponds to every single Entity modified in the commit. For those
where a partial Key was completed, the MutationResult.key holds the
new key. For those were no key was completed, MutationResult.key
is empty.

@dhermes dhermes added the api: datastore Issues related to the Datastore API. label Dec 22, 2015
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Dec 22, 2015
@dhermes dhermes mentioned this pull request Dec 22, 2015
49 tasks
Also moving out the response parsing into a helper which can
be monkey-patched out during testing.

This is for the `v1beta2` to `v1beta3` change. Currently the
`CommitResponse` object contains a single `MutationResult` that holds
an integer `index_updates` field and a repeated field (`insert_auto_id_key`)
of partial `Key`s that were completed in the `commit`.

In `v1beta3`, the `CommitResponse` directly holds the integer `index_updates`
as well as a list of `MutationResult`s. Additionally, the definition of
`MutationResult` no longer has `index_updates` (obviously given the last
sentence) and no longer holds a list of `Key`s. Instead, it holds a single
`Key` in the `key` field. What's more, the list of `MutationResult`s
corresponds to every single `Entity` modified in the commit. For those
where a partial `Key` was completed, the `MutationResult.key` holds the
new key. For those were **no key was completed**, `MutationResult.key`
is empty.
@dhermes dhermes force-pushed the datastore-commit-change-result branch from c48c8bf to 607a05b Compare December 22, 2015 04:43
mut_result = commit_response_pb.mutation_result
index_updates = mut_result.index_updates
completed_keys = list(mut_result.insert_auto_id_key)
return index_updates, completed_keys

This comment was marked as spam.

This comment was marked as spam.

@tseaver
Copy link
Contributor

tseaver commented Dec 22, 2015

LGTM

dhermes added a commit that referenced this pull request Dec 22, 2015
Reducing datastore commit reliance on structure of response.
@dhermes dhermes merged commit e4c2819 into googleapis:master Dec 22, 2015
@dhermes dhermes deleted the datastore-commit-change-result branch December 22, 2015 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: datastore Issues related to the Datastore API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants