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

Async start await prototype #1

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@ extend-ignore-identifiers-re = [
# This pattern can be found in long hex strings.
"[0-9]caf[0-9]",
# This is a GCS dual-region name.
"NAM4"
"NAM4",
# Metadata is mispelled in this proto message name found in
# google/cloud/aiplatform/v1/vizier_service.proto
"CheckTrialEarlyStoppingStateMetatdata"
]
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_KITCHEN_SINK_CLIENT_H

#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection.h"
#include "google/cloud/experimental_tag.h"
#include "google/cloud/future.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "generator/integration_tests/golden/v1/golden_kitchen_sink_connection_idempotency_policy.h"
#include "generator/integration_tests/golden/v1/internal/golden_kitchen_sink_retry_traits.h"
#include "google/cloud/backoff_policy.h"
#include "google/cloud/experimental_tag.h"
#include "google/cloud/future.h"
#include "google/cloud/internal/async_read_write_stream_impl.h"
#include "google/cloud/internal/retry_policy_impl.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_REST_ONLY_CLIENT_H

#include "generator/integration_tests/golden/v1/golden_rest_only_rest_connection.h"
#include "google/cloud/experimental_tag.h"
#include "google/cloud/future.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "generator/integration_tests/golden/v1/golden_rest_only_connection_idempotency_policy.h"
#include "generator/integration_tests/golden/v1/internal/golden_rest_only_retry_traits.h"
#include "google/cloud/backoff_policy.h"
#include "google/cloud/experimental_tag.h"
#include "google/cloud/internal/retry_policy_impl.h"
#include "google/cloud/options.h"
#include "google/cloud/status_or.h"
Expand Down
98 changes: 98 additions & 0 deletions generator/integration_tests/golden/v1/golden_thing_admin_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,33 @@ GoldenThingAdminClient::CreateDatabase(std::string const& parent, std::string co
return connection_->CreateDatabase(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::CreateDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, std::string const& create_statement, Options opts)
{ internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
google::test::admin::database::v1::CreateDatabaseRequest request;
request.set_parent(parent);
request.set_create_statement(create_statement);
return connection_->CreateDatabase(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::CreateDatabase(google::test::admin::database::v1::CreateDatabaseRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateDatabase(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::CreateDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::CreateDatabaseRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateDatabase(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::CreateDatabase(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateDatabase(google::cloud::ExperimentalTag{}, operation);
}

StatusOr<google::test::admin::database::v1::Database>
GoldenThingAdminClient::GetDatabase(std::string const& name, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
Expand All @@ -86,12 +107,33 @@ GoldenThingAdminClient::UpdateDatabaseDdl(std::string const& database, std::vect
return connection_->UpdateDatabaseDdl(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& database, std::vector<std::string> const& statements, Options opts)
{ internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
google::test::admin::database::v1::UpdateDatabaseDdlRequest request;
request.set_database(database);
*request.mutable_statements() = {statements.begin(), statements.end()};
return connection_->UpdateDatabaseDdl(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::UpdateDatabaseDdlMetadata>>
GoldenThingAdminClient::UpdateDatabaseDdl(google::test::admin::database::v1::UpdateDatabaseDdlRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->UpdateDatabaseDdl(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::UpdateDatabaseDdlRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->UpdateDatabaseDdl(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::UpdateDatabaseDdlMetadata>>
GoldenThingAdminClient::UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->UpdateDatabaseDdl(google::cloud::ExperimentalTag{}, operation);
}

Status
GoldenThingAdminClient::DropDatabase(std::string const& database, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
Expand Down Expand Up @@ -208,12 +250,34 @@ GoldenThingAdminClient::CreateBackup(std::string const& parent, google::test::ad
return connection_->CreateBackup(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::CreateBackup(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, google::test::admin::database::v1::Backup const& backup, std::string const& backup_id, Options opts)
{ internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
google::test::admin::database::v1::CreateBackupRequest request;
request.set_parent(parent);
*request.mutable_backup() = backup;
request.set_backup_id(backup_id);
return connection_->CreateBackup(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Backup>>
GoldenThingAdminClient::CreateBackup(google::test::admin::database::v1::CreateBackupRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateBackup(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::CreateBackup(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::CreateBackupRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateBackup(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Backup>>
GoldenThingAdminClient::CreateBackup(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->CreateBackup(google::cloud::ExperimentalTag{}, operation);
}

StatusOr<google::test::admin::database::v1::Backup>
GoldenThingAdminClient::GetBackup(std::string const& name, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
Expand Down Expand Up @@ -281,12 +345,34 @@ GoldenThingAdminClient::RestoreDatabase(std::string const& parent, std::string c
return connection_->RestoreDatabase(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::RestoreDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, std::string const& database_id, std::string const& backup, Options opts)
{ internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
google::test::admin::database::v1::RestoreDatabaseRequest request;
request.set_parent(parent);
request.set_database_id(database_id);
request.set_backup(backup);
return connection_->RestoreDatabase(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::RestoreDatabase(google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->RestoreDatabase(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::RestoreDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->RestoreDatabase(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::RestoreDatabase(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->RestoreDatabase(google::cloud::ExperimentalTag{}, operation);
}

StreamRange<google::longrunning::Operation>
GoldenThingAdminClient::ListDatabaseOperations(std::string const& parent, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
Expand Down Expand Up @@ -321,6 +407,18 @@ GoldenThingAdminClient::LongRunningWithoutRouting(google::test::admin::database:
return connection_->LongRunningWithoutRouting(request);
}

StatusOr<google::longrunning::Operation>
GoldenThingAdminClient::LongRunningWithoutRouting(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->LongRunningWithoutRouting(google::cloud::ExperimentalTag{}, google::cloud::NoAwaitTag{}, request);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::LongRunningWithoutRouting(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
return connection_->LongRunningWithoutRouting(google::cloud::ExperimentalTag{}, operation);
}

future<StatusOr<google::test::admin::database::v1::Database>>
GoldenThingAdminClient::AsyncGetDatabase(std::string const& name, Options opts) {
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
Expand Down
48 changes: 48 additions & 0 deletions generator/integration_tests/golden/v1/golden_thing_admin_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
#define GOOGLE_CLOUD_CPP_GENERATOR_INTEGRATION_TESTS_GOLDEN_V1_GOLDEN_THING_ADMIN_CLIENT_H

#include "generator/integration_tests/golden/v1/golden_thing_admin_connection.h"
#include "google/cloud/experimental_tag.h"
#include "google/cloud/future.h"
#include "google/cloud/internal/make_status.h"
#include "google/cloud/no_await_tag.h"
#include "google/cloud/options.h"
#include "google/cloud/polling_policy.h"
#include "google/cloud/status_or.h"
Expand Down Expand Up @@ -213,6 +215,10 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Database>>
CreateDatabase(std::string const& parent, std::string const& create_statement, Options opts = {});

StatusOr<google::longrunning::Operation>
CreateDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, std::string const& create_statement, Options opts = {})
;

// clang-format off
///
/// Creates a new Cloud Test database and starts to prepare it for serving.
Expand Down Expand Up @@ -261,6 +267,12 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Database>>
CreateDatabase(google::test::admin::database::v1::CreateDatabaseRequest const& request, Options opts = {});

StatusOr<google::longrunning::Operation>
CreateDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::CreateDatabaseRequest const& request, Options opts = {});

future<StatusOr<google::test::admin::database::v1::Database>>
CreateDatabase(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts = {});

// clang-format off
///
/// Gets the state of a Cloud Test database.
Expand Down Expand Up @@ -359,6 +371,10 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::UpdateDatabaseDdlMetadata>>
UpdateDatabaseDdl(std::string const& database, std::vector<std::string> const& statements, Options opts = {});

StatusOr<google::longrunning::Operation>
UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& database, std::vector<std::string> const& statements, Options opts = {})
;

// clang-format off
///
/// Updates the schema of a Cloud Test database by
Expand Down Expand Up @@ -405,6 +421,12 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::UpdateDatabaseDdlMetadata>>
UpdateDatabaseDdl(google::test::admin::database::v1::UpdateDatabaseDdlRequest const& request, Options opts = {});

StatusOr<google::longrunning::Operation>
UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::UpdateDatabaseDdlRequest const& request, Options opts = {});

future<StatusOr<google::test::admin::database::v1::UpdateDatabaseDdlMetadata>>
UpdateDatabaseDdl(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts = {});

// clang-format off
///
/// Drops (aka deletes) a Cloud Test database.
Expand Down Expand Up @@ -822,6 +844,10 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Backup>>
CreateBackup(std::string const& parent, google::test::admin::database::v1::Backup const& backup, std::string const& backup_id, Options opts = {});

StatusOr<google::longrunning::Operation>
CreateBackup(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, google::test::admin::database::v1::Backup const& backup, std::string const& backup_id, Options opts = {})
;

// clang-format off
///
/// Starts creating a new Cloud Test Backup.
Expand Down Expand Up @@ -874,6 +900,12 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Backup>>
CreateBackup(google::test::admin::database::v1::CreateBackupRequest const& request, Options opts = {});

StatusOr<google::longrunning::Operation>
CreateBackup(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::CreateBackupRequest const& request, Options opts = {});

future<StatusOr<google::test::admin::database::v1::Backup>>
CreateBackup(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts = {});

// clang-format off
///
/// Gets metadata on a pending or completed
Expand Down Expand Up @@ -1193,6 +1225,10 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Database>>
RestoreDatabase(std::string const& parent, std::string const& database_id, std::string const& backup, Options opts = {});

StatusOr<google::longrunning::Operation>
RestoreDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, std::string const& parent, std::string const& database_id, std::string const& backup, Options opts = {})
;

// clang-format off
///
/// Create a new database by restoring from a completed backup. The new
Expand Down Expand Up @@ -1250,6 +1286,12 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Database>>
RestoreDatabase(google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts = {});

StatusOr<google::longrunning::Operation>
RestoreDatabase(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts = {});

future<StatusOr<google::test::admin::database::v1::Database>>
RestoreDatabase(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts = {});

// clang-format off
///
/// Lists database [longrunning-operations][google.longrunning.Operation].
Expand Down Expand Up @@ -1471,6 +1513,12 @@ class GoldenThingAdminClient {
future<StatusOr<google::test::admin::database::v1::Database>>
LongRunningWithoutRouting(google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts = {});

StatusOr<google::longrunning::Operation>
LongRunningWithoutRouting(google::cloud::ExperimentalTag, google::cloud::NoAwaitTag, google::test::admin::database::v1::RestoreDatabaseRequest const& request, Options opts = {});

future<StatusOr<google::test::admin::database::v1::Database>>
LongRunningWithoutRouting(google::cloud::ExperimentalTag, google::longrunning::Operation const& operation, Options opts = {});

// clang-format off
///
/// Gets the state of a Cloud Test database.
Expand Down
Loading