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

Getting latency results #1204

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
242d8f0
Add a unit test for commit as a non-tx
danieljbruce Sep 13, 2023
8a7b0ea
use linter
danieljbruce Nov 1, 2023
d0cd928
Write tests to capture current behavior of error
danieljbruce Nov 1, 2023
ed5a301
Add tests for passing a response
danieljbruce Nov 1, 2023
b3b13b4
run async close to working
danieljbruce Nov 1, 2023
85ec536
Add runAsync to promise excludes
danieljbruce Nov 1, 2023
d26ebd3
Remove space
danieljbruce Nov 1, 2023
2d13f56
Change to use this instead of self
danieljbruce Nov 1, 2023
3f66406
Eliminate unused comments
danieljbruce Nov 1, 2023
ff76a6d
Add two comments
danieljbruce Nov 1, 2023
d7806bd
Remove the commit test for this PR
danieljbruce Nov 1, 2023
01d7837
Clarify types throughout the function
danieljbruce Nov 1, 2023
dff3183
Add a bit more typing for clarity
danieljbruce Nov 1, 2023
f4e05bd
Change types used in the data client callback
danieljbruce Nov 2, 2023
6d50e94
run the linter
danieljbruce Nov 2, 2023
875bf4b
Add comments to clarify PR
danieljbruce Nov 2, 2023
ea80c65
Refactor the parsing logic out of run
danieljbruce Nov 2, 2023
14af87e
Change interface of request promise callback
danieljbruce Nov 2, 2023
3a28892
Move commit functionality to a new function
danieljbruce Nov 2, 2023
5de4545
Add the mutex and transaction state etc.
danieljbruce Nov 2, 2023
1ccacec
Remove no-op, get commit tests working
danieljbruce Nov 3, 2023
37918d7
Add mocks and additional debugging
danieljbruce Nov 3, 2023
a02d293
Add tests for commit
danieljbruce Nov 3, 2023
3293a9c
Add the commit tests
danieljbruce Nov 3, 2023
f4a41d6
Fix the tests so that they pass on commit
danieljbruce Nov 3, 2023
1d8b374
refactor one of the mocks
danieljbruce Nov 3, 2023
41beeca
Merge branch 'nodejs-transaction-redesign-feature-branch-1a-add-commi…
danieljbruce Nov 3, 2023
81f2ec0
reverting changes to add new test on transaction
danieljbruce Nov 3, 2023
a5bafbb
Merge branch 'nodejs-transaction-redesign-feature-branch-1a-add-commi…
danieljbruce Nov 3, 2023
d5f5f4b
Change the promise
danieljbruce Nov 3, 2023
ba363e0
Hide data completely
danieljbruce Nov 6, 2023
9f50cba
PR use if/else block
danieljbruce Nov 6, 2023
f96471d
Add comments to document the new functions
danieljbruce Nov 6, 2023
59ee72a
Update return type in docs
danieljbruce Nov 6, 2023
34e961e
Update the tests to include runAsync
danieljbruce Nov 6, 2023
38cd2ef
refactor: Break transaction.run into smaller pieces for use with asyn…
danieljbruce Nov 6, 2023
08fe164
Merge branch 'nodejs-transaction-change-run' of https://github.com/da…
danieljbruce Nov 6, 2023
ad39a90
Rename a function to be more descriptive
danieljbruce Nov 6, 2023
c9e8e95
Move the mutex and the state down to derived class
danieljbruce Nov 6, 2023
071d04b
Add hook to call run before commit
danieljbruce Nov 6, 2023
3ff33cc
Add commitAsync to promisify excludes
danieljbruce Nov 6, 2023
bddc355
remove the console logs
danieljbruce Nov 6, 2023
b33d593
Delete run commit
danieljbruce Nov 6, 2023
b055e3d
Remove the private identifier
danieljbruce Nov 6, 2023
f3c0e1d
Add withBeginTransaction
danieljbruce Nov 6, 2023
cebc155
Add another level of abstraction
danieljbruce Nov 6, 2023
fe78cc6
commit async is not needed anymore
danieljbruce Nov 6, 2023
36360a7
This data structure is not needed anymore
danieljbruce Nov 6, 2023
33e09ac
Replace types associated with run to use generics
danieljbruce Nov 6, 2023
8e8f545
Make response type more specific for parseRunAsync
danieljbruce Nov 6, 2023
c129bd2
Modify comment
danieljbruce Nov 7, 2023
d4b40e8
Add implementation for runQuery
danieljbruce Nov 7, 2023
6c7a147
Making fixes for runAggregationQuery
danieljbruce Nov 7, 2023
4c3cb5c
Write tests for runAggregateQuery
danieljbruce Nov 7, 2023
d507229
Get one test case passing for runAggregateQuery
danieljbruce Nov 7, 2023
8afa968
remove console log clutter
danieljbruce Nov 7, 2023
db48cb3
Change tests for runAggregationQuery
danieljbruce Nov 7, 2023
69cd491
Add resolver type
danieljbruce Nov 7, 2023
c31193e
Create a transaction wrapper class for testing
danieljbruce Nov 8, 2023
a608589
Clean up mocked transaction wrapper
danieljbruce Nov 8, 2023
2d23d07
Move test information for commit into commit block
danieljbruce Nov 8, 2023
e09ab36
Add gapic mocked tests for aggregation query
danieljbruce Nov 8, 2023
fbbb0d8
Fixing up the runQuery test
danieljbruce Nov 8, 2023
cf85fd0
Finished the runQuery tests
danieljbruce Nov 8, 2023
39b9f24
Finished the get tests
danieljbruce Nov 8, 2023
dce0836
remove only
danieljbruce Nov 8, 2023
31a2a47
Merge branch 'nodejs-transaction-redesign-feature-branch-1a-add-commi…
danieljbruce Nov 8, 2023
2391ca8
remove only and console log
danieljbruce Nov 8, 2023
905c7da
Try modifications to runQuery
danieljbruce Nov 8, 2023
5074de0
Add try catch blocks to handle errors in the tests
danieljbruce Nov 8, 2023
d1ae72b
Merge branch 'nodejs-transaction-redesign-feature-branch-1a-add-commi…
danieljbruce Nov 8, 2023
d78210a
Modify commit so it doesn’t run early
danieljbruce Nov 8, 2023
13f9b09
Update get with resolver
danieljbruce Nov 8, 2023
14dc743
remove #beginWithCallback
danieljbruce Nov 8, 2023
898df42
Remove #withBeginTransaction
danieljbruce Nov 8, 2023
c20974e
Rename #someFunction with begin transaction
danieljbruce Nov 8, 2023
ce852d1
Fix promisify. Change to a deepStrictEqual check.
danieljbruce Nov 8, 2023
b0fe8f4
Add setImmediate to the tests
danieljbruce Nov 9, 2023
3c52842
Added some tests for call ordering
danieljbruce Nov 9, 2023
816ab0c
Pack testing tool into an object
danieljbruce Nov 9, 2023
21f3afd
Eliminate console logs, use expected order
danieljbruce Nov 9, 2023
7677400
Add a check for transaction not started yet
danieljbruce Nov 9, 2023
abf58ed
Merge branch 'nodejs-transaction-change-run' of https://github.com/da…
danieljbruce Nov 9, 2023
0d05f4c
Merge branch 'nodejs-transaction-redesign-feature-branch-1a-add-commi…
danieljbruce Nov 9, 2023
e9bd732
Merge branch 'nodejs-transaction-redesign-feature-branch-2-adding-com…
danieljbruce Nov 9, 2023
34903bd
Remove NOT_TRANSACTION
danieljbruce Nov 10, 2023
390d5ee
Remove only
danieljbruce Nov 10, 2023
c8b5c49
Use an enum instead of static class members
danieljbruce Nov 10, 2023
0bdfa0b
TODOs are done
danieljbruce Nov 10, 2023
623bb76
Move excludes to proper position
danieljbruce Nov 10, 2023
521f11c
Simplify the run function a little bit
danieljbruce Nov 10, 2023
9af9ffd
Merge branch 'nodejs-transaction-redesign-feature-branch-2a-adding-co…
danieljbruce Nov 10, 2023
32d40d2
Add comments to tests
danieljbruce Nov 10, 2023
0449676
Modify tests and fix a bug from the merge
danieljbruce Nov 10, 2023
36189de
Fix error message
danieljbruce Nov 10, 2023
1fb109b
Comments and general cleanup
danieljbruce Nov 10, 2023
f09b6f8
Added comments for functions in transaction.ts
danieljbruce Nov 10, 2023
6b73bbf
Add a comment for aggregate queries
danieljbruce Nov 10, 2023
9b4715d
Add an assertion to test
danieljbruce Nov 10, 2023
6e73771
Add tests for lookup, put, commit
danieljbruce Nov 10, 2023
74097f3
refactor the test
danieljbruce Nov 10, 2023
41fc42b
Add tests for put, lookup, commit
danieljbruce Nov 10, 2023
1cfaa6c
Add comments and general cleanup
danieljbruce Nov 14, 2023
2ff43b8
Remove some redundant tests
danieljbruce Nov 14, 2023
351840c
Correct the comment to be more accurate
danieljbruce Nov 14, 2023
e797c34
General improvements to code quality
danieljbruce Nov 15, 2023
4eb7a5e
Add data client check
danieljbruce Nov 15, 2023
355c0a5
Eliminate the mocked function variable
danieljbruce Nov 15, 2023
310b320
Move begin transaction setup code
danieljbruce Nov 15, 2023
b151740
Replace the TODO for the key
danieljbruce Nov 15, 2023
a369202
Update description
danieljbruce Nov 15, 2023
99530ea
Add comments to describe the purpose of signaller
danieljbruce Nov 15, 2023
a42c7fe
Add both dones back in
danieljbruce Nov 15, 2023
ca6f63b
mockedBeginTransaction should be Function
danieljbruce Nov 15, 2023
3a76ee0
Use ECMA script modifier
danieljbruce Nov 15, 2023
e250bad
Remove TODOs that no longer apply
danieljbruce Nov 15, 2023
a146626
beginTransaction type definition
danieljbruce Nov 15, 2023
7430ede
Merge branch 'main' of https://github.com/googleapis/nodejs-datastore…
danieljbruce Nov 15, 2023
7284d99
refactor: Break transaction.run into smaller pieces for use with asyn…
danieljbruce Nov 17, 2023
f312716
Merge branch 'nodejs-transaction-redesign-feature-branch' of https://…
danieljbruce Nov 17, 2023
cc4bbb8
Add the setupBeginTransaction method
danieljbruce Nov 17, 2023
cb3ec1b
Add a comment for private runCommit method
danieljbruce Nov 17, 2023
7b0a98a
Modify comment to be more clear
danieljbruce Nov 17, 2023
8b0d3c7
Update comments
danieljbruce Nov 17, 2023
b7ebc51
Eliminate redundant test code
danieljbruce Nov 17, 2023
c050d50
revert comment
danieljbruce Nov 17, 2023
a5efe6e
refactor: Move commit logic and add tests that prepare for transactio…
danieljbruce Nov 17, 2023
2544ed9
Merge branch 'nodejs-transaction-redesign-feature-branch-2aa-adding-t…
danieljbruce Nov 17, 2023
bd25e82
Merge branch 'nodejs-transaction-redesign-feature-branch-2aa-adding-t…
danieljbruce Nov 17, 2023
3df2bf4
runQuery, put, commit
danieljbruce Nov 20, 2023
df4f69b
run linter and group some tests into a describe block so that they do…
danieljbruce Nov 20, 2023
8971c2c
Add some runAggregationQuery integration tests
danieljbruce Nov 20, 2023
9cd614c
Add tests for put, runAggregationQuery, commit
danieljbruce Nov 20, 2023
bc9eca6
Write some latency tests
danieljbruce Nov 20, 2023
97e9f3c
Add logs to make latency tests run
danieljbruce Nov 20, 2023
a8764ef
Add two tests for put, commit
danieljbruce Nov 21, 2023
fc5546a
Build requests into the transaction order tester
danieljbruce Nov 21, 2023
c051035
Modify order testing
danieljbruce Nov 21, 2023
6d05dc1
Create lookup, lookup, put, commit
danieljbruce Nov 21, 2023
fb6ee90
Fix the unit test
danieljbruce Nov 21, 2023
beb4c8c
Add lookup requests
danieljbruce Nov 22, 2023
4f42a67
Remove the console logs
danieljbruce Nov 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"dependencies": {
"@google-cloud/promisify": "^4.0.0",
"arrify": "^2.0.1",
"async-mutex": "^0.4.0",
"concat-stream": "^2.0.0",
"extend": "^3.0.2",
"google-gax": "^4.0.5",
Expand Down
12 changes: 12 additions & 0 deletions src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
KeyProto,
ResponseResult,
Entities,
ValueProto,

Check warning on line 47 in src/request.ts

View workflow job for this annotation

GitHub Actions / lint

'ValueProto' is defined but never used
} from './entity';
import {
Query,
Expand Down Expand Up @@ -546,6 +546,18 @@
);
}

/**
* Datastore allows you to run aggregate queries by aggregate field.
*
* The query is run, and the results are returned as the second argument to
* your callback.
*
* @param {AggregateQuery} query AggregateQuery object.
* @param {RunQueryOptions} options Optional configuration
* @param {function} [callback] The callback function. If omitted, a promise is
* returned.
*
**/
runAggregationQuery(
query: AggregateQuery,
options?: RunQueryOptions
Expand Down Expand Up @@ -596,9 +608,9 @@
const results = res.batch.aggregationResults;
const finalResults = results
.map(
(aggregationResult: any) => aggregationResult.aggregateProperties

Check warning on line 611 in src/request.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
)
.map((aggregateProperties: any) =>

Check warning on line 613 in src/request.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
Object.fromEntries(
new Map(
Object.keys(aggregateProperties).map(key => [
Expand Down Expand Up @@ -933,7 +945,7 @@
callback?: SaveCallback
): void | Promise<CommitResponse> {
const transaction = this.datastore.transaction();
transaction.run(async (err: any) => {

Check warning on line 948 in src/request.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
if (err) {
try {
await transaction.rollback();
Expand Down
Loading
Loading