Skip to content

Conversation

@chemelnucfin
Copy link
Contributor

@chemelnucfin chemelnucfin commented Nov 2, 2017

Uses #4348 as a base.


Please look it over and feel free to critique.

Also let me know what I'm missing.

Closes #4278.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 2, 2017
Copy link
Contributor

@dhermes dhermes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chemelnucfin Thanks for the work but it seems this effort is futile until support for TransactionOptions is in the gapic-google-cloud-datastore-v1 library (since the underlying GAX / proto-over-HTTP clients will never send the right payload).

That requires @lukesneeringer (or someone on his team) to regenerate the library.

:type previous_transaction: `bytes`
:param previous_transaction: The transaction identifier of the transaction
being retried.

This comment was marked as spam.

This comment was marked as spam.

ReadWrite. In the case of ReadWrite an optional parameter allows the
previous transaction id to be stored.
:type readonly: `boolean`

This comment was marked as spam.

This comment was marked as spam.

"""

class ReadWrite(object):

This comment was marked as spam.

This comment was marked as spam.

from google.cloud.datastore.batch import Batch


class TransactionOptions(object):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

self._id = None

def put(self, entity):
"""Remember an entity's state to be saved during :meth:`commit`.

This comment was marked as spam.

This comment was marked as spam.

"""Remember an entity's state to be saved during :meth:`commit`.
.. note::
Any existing properties for the entity will be replaced by those

This comment was marked as spam.

This comment was marked as spam.

if isinstance(self.options.mode, self.options.ReadWrite):
super(Transaction, self).put(entity)
else:
raise RuntimeError("Transaction is read only")

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

import mock
from google.cloud.datastore.transaction import TransactionOptions

class TestTransactionOptions(unittest.TestCase):

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

import unittest

import mock
from google.cloud.datastore.transaction import TransactionOptions

This comment was marked as spam.

This comment was marked as spam.

@chemelnucfin
Copy link
Contributor Author

Thank you for your comments.
Should I incorporate these comments now or wait until @lukesneeringer regenerates the library?

@dhermes
Copy link
Contributor

dhermes commented Nov 3, 2017

Should I incorporate these comments now or wait until lukesneeringer regenerates the library?

IMO it's not worth working on this until you can actually send the payload to the live server, so I would wait.

@chemelnucfin chemelnucfin changed the title Datastore: Transaction Options Datastore: Transaction Options #4278 Nov 3, 2017
@lukesneeringer
Copy link
Contributor

lukesneeringer commented Nov 6, 2017

@chemelnucfin Thanks for the work but it seems this effort is futile until support for TransactionOptions is in the gapic-google-cloud-datastore-v1 library (since the underlying GAX / proto-over-HTTP clients will never send the right payload).

That requires @lukesneeringer (or someone on his team) to regenerate the library.

I am happy to do that as soon as I get in to the office.

@tseaver tseaver changed the title Datastore: Transaction Options #4278 Add support for 'TransactionOptions' Nov 6, 2017
@tseaver tseaver added api: datastore Issues related to the Datastore API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Nov 6, 2017
@lukesneeringer
Copy link
Contributor

Auto-gen updated. In theory, this should now work against the live service (and we should test to ensure that).

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Nov 6, 2017
@chemelnucfin chemelnucfin force-pushed the issue4278-transactionoption branch from 8b5a48b to cf97b76 Compare November 6, 2017 20:27
@chemelnucfin
Copy link
Contributor Author

See #4357

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: no This human has *not* signed the Contributor License Agreement. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants