Skip to content

feat(generator): use async for long-running operations#6830

Merged
coryan merged 2 commits intogoogleapis:mainfrom
coryan:feat-generator-use-async-for-long-running
Jun 22, 2021
Merged

feat(generator): use async for long-running operations#6830
coryan merged 2 commits intogoogleapis:mainfrom
coryan:feat-generator-use-async-for-long-running

Conversation

@coryan
Copy link
Copy Markdown
Contributor

@coryan coryan commented Jun 21, 2021

For long-running operations we need to generate three different RPCs:
one to start the operation (e.g. CreateDatabase()), one to poll the
operation (GetOperation()), and one to cancel the operation
(CancelOperation()). With this change all the three RPCs are
generated as asynchronous RPCs.

The *Connection class can use these asynchronous RPCs in the
background, using the background threads. This (1) avoids creating a
detached thread to poll the operation, (2) uses code that is more easily
unit tested separate from the generated libraries.

Fixes #6821


This change is Reviewable

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Jun 21, 2021
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: d2dceefa9ba207afa42e53b61fd5cfb7c9d503fb

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 21, 2021

Codecov Report

Merging #6830 (b572fa7) into main (54f4b5c) will decrease coverage by 0.00%.
The diff coverage is 99.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #6830      +/-   ##
==========================================
- Coverage   95.04%   95.04%   -0.01%     
==========================================
  Files        1264     1264              
  Lines      113316   113312       -4     
==========================================
- Hits       107697   107693       -4     
  Misses       5619     5619              
Impacted Files Coverage Δ
...lden/internal/golden_kitchen_sink_auth_decorator.h 100.00% <ø> (ø)
...olden/internal/golden_thing_admin_auth_decorator.h 100.00% <ø> (ø)
...en/internal/golden_thing_admin_logging_decorator.h 100.00% <ø> (ø)
...n/internal/golden_thing_admin_metadata_decorator.h 100.00% <ø> (ø)
...on_tests/golden/internal/golden_thing_admin_stub.h 100.00% <ø> (ø)
...tests/golden/tests/golden_thing_admin_stub_test.cc 87.16% <98.95%> (+0.82%) ⬆️
...golden/tests/golden_thing_admin_connection_test.cc 99.50% <99.12%> (-0.14%) ⬇️
...tion_tests/golden/golden_thing_admin_connection.cc 77.37% <100.00%> (-2.10%) ⬇️
...lden/internal/golden_thing_admin_auth_decorator.cc 100.00% <100.00%> (ø)
...n/internal/golden_thing_admin_logging_decorator.cc 100.00% <100.00%> (ø)
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54f4b5c...b572fa7. Read the comment docs.

@coryan coryan force-pushed the feat-generator-use-async-for-long-running branch from d2dceef to b95a7cb Compare June 21, 2021 23:53
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: b95a7cb0e07ecc7a0f6ffb6906cd647f343b5b68

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

For long-running operations we need to generate three different RPCs:
one to start the operation (e.g. `CreateDatabase()`), one to poll the
operation (`GetOperation()`), and one to cancel the operation
(`CancelOperation()`).  With this change all the three RPCs are
generated as asynchronous RPCs.

The `*Connection` class can use these asynchronous RPCs in the
background, using the background threads. This (1) avoids creating a
detached thread to poll the operation, (2) uses code that is more easily
unit tested separate from the generated libraries.
@coryan coryan force-pushed the feat-generator-use-async-for-long-running branch from b95a7cb to 145830a Compare June 22, 2021 12:09
@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: 145830a43d59ce07d4806df744705941aec4a5c5

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Copy Markdown
Contributor

Google Cloud Build Logs
For commit: b572fa7774cba5e4d83fd535f2452145e78f5df5

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan marked this pull request as ready for review June 22, 2021 12:59
@coryan coryan requested a review from a team June 22, 2021 12:59
@coryan coryan merged commit 43cc041 into googleapis:main Jun 22, 2021
@coryan coryan deleted the feat-generator-use-async-for-long-running branch June 22, 2021 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use existing background threads for long running operations

3 participants