SIGN IN SIGN UP

feat: new transaction feature (#1239)

* Move the state up, make it protected

Transaction state should move up to the super class

* Build new transaction options method

Add a method for building transaction options. Also add a method for detecting if a request is a transaction. Build new transaction options

* Correct the fn that builds transactions

Corrected getTransactionRequest. Build the request options properly.

* Set transaction to readOnly in system test.

When this system test isn’t set to be a readOnly transaction then the error occurs which says too much contention.

* Change #parseRunSuccess

Change parseRunSuccess so that it can be used more universally.

* Move parseRunSuccess up to protected

parseRunSuccess should move up to the super class because it now needs to be used there.

* Saves the transaction id

This change saves the transaction id returned from the server for read calls

* Add tests for testing read only transactions

Read only tests are needed

* Add tests that measure read time

Make sure that code using the new transaction option has better performance than code that doesn’t have it.

* ran linter

* Add a test for testing requests

Use the MockedTransactionWrapper to test requests being passed into the Gapic layer.

* Final changes to make test work

Mock out begin transaction. Test for newTransaction consistency type. Mock out commit.

* Add the transaction.run test

A transaction.run test is needed  for lookup, lookup, put, commit.

* run linter

* runQuery, lookup, put, commit

Add a test for this sequence of operations and ensure it works properly.

* runAggregationQuery, lookup, put, commit

Four operations that get all the results for running an aggregation query. Adding another test for these four operations.

* put, put, lookup, commit

Last test suite regarding new transaction unit tests.

* Add tests for the commits

Add a bunch of tests for the commit case. Check the commit gapic input.

* Add testing to ensure begin tx is called

Begin transaction should be called at least once. Add code here to increment the counter.

* Document #blockWithMutex

Remove commented code too.

* Document transaction state

* feat: new transaction feature branch

* Add a check for expired

Check for expired on most functions and write tests for the expired check.

* Add commit and rollback blocks

Check for expired state in the commit and rollback blocks.

* run the linter

* Don’t allow readtime to be specified in a txn

Matches the python client.

* throw error for both read time and consistency

* Add test for specifying readtime

* Remove the console logs

* Refactor the test

* Improve test to make sure Gapic layer isn’t called

Also, fix bug with read consistency.

* Run linter
Reorganize tests
New test for readtime and consistency

* Make change to allow the runAggregationQuery go up

* Should error when get is used

* Move tests over and refactor initialized datastore

* Remove only and remove imports

* Introduce parameterized testing for errors

* Use parameters in parameterized tests

* Migrate error tests to parameterized testing

* Change description

* Prepare second describe block for tests

* Revert "Prepare second describe block for tests"

This reverts commit 974117b05b4e387a4e34668651967641bbde501c.

* Always return after the error is sent back

This ensures that an extra call does not get made to the server.

* Add headers

* Tests and implementation for expired on rollback

* fix test

* Wrap rollbacks with a withBeginTransaction.

* Update the test so that it begins the tx before

* Throw error if transaction not started on rollback

* Remove only

* Add a comment to the test regarding new txn.run()

* Ensure that the errors get bubbled up

* Run. linter

* read time and consistency error

* Remove unnecessary change

* Eliminate the call to withBeginTransaction

* Throw error reported in documentation

* Work on streaming errors

Fix the concurrency tests and move the error reporting outside of the stream, add two tests for the streams to make sure errors get reported.

* Move the error throwing up the stack

This makes it so that it is reported in the streams.

* Fix linting errors

* Generate unit tests for getTransactionRequest

I am going to rewrite the getTransactionRequest function so it is a good idea not to change how it works.

* Generate unit tests

Fix the compiler error
Change code so that when readOnly is specified then readwrite options are ignored.
Fix the unit test to adopt this change.

* Make function one ternary operation

Add comments, simplify logic in the function.

* Add two comments

* Update the comment

* Run the linter
D
danieljbruce committed
cdd2ee98c50b48b9a2a8cfb2f66b84a5937b3783
Parent: 91237e0
Committed by GitHub <noreply@github.com> on 6/24/2024, 6:42:51 PM