From e821573cb61752d4a7eaef1b90c735c8defd269d Mon Sep 17 00:00:00 2001 From: Scott Hart Date: Wed, 18 Mar 2026 19:20:56 -0400 Subject: [PATCH] impl(bigtable): add RandomTwoLeastUsed stub decorator --- google/cloud/bigtable/CMakeLists.txt | 3 + .../bigtable/bigtable_client_unit_tests.bzl | 1 + .../bigtable/google_cloud_cpp_bigtable.bzl | 2 + ...igtable_random_two_least_used_decorator.cc | 343 ++++++++++++++++++ ...bigtable_random_two_least_used_decorator.h | 146 ++++++++ ...le_random_two_least_used_decorator_test.cc | 212 +++++++++++ 6 files changed, 707 insertions(+) create mode 100644 google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc create mode 100644 google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h create mode 100644 google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator_test.cc diff --git a/google/cloud/bigtable/CMakeLists.txt b/google/cloud/bigtable/CMakeLists.txt index 597d6bfa741ee..5dc1c42f4ed68 100644 --- a/google/cloud/bigtable/CMakeLists.txt +++ b/google/cloud/bigtable/CMakeLists.txt @@ -155,6 +155,8 @@ add_library( internal/bigtable_logging_decorator.h internal/bigtable_metadata_decorator.cc internal/bigtable_metadata_decorator.h + internal/bigtable_random_two_least_used_decorator.cc + internal/bigtable_random_two_least_used_decorator.h internal/bigtable_round_robin_decorator.cc internal/bigtable_round_robin_decorator.h internal/bigtable_stub.cc @@ -444,6 +446,7 @@ if (BUILD_TESTING) internal/async_row_sampler_test.cc internal/async_streaming_read_test.cc internal/bigtable_channel_refresh_test.cc + internal/bigtable_random_two_least_used_decorator_test.cc internal/bigtable_stub_factory_test.cc internal/bulk_mutator_test.cc internal/channel_usage_test.cc diff --git a/google/cloud/bigtable/bigtable_client_unit_tests.bzl b/google/cloud/bigtable/bigtable_client_unit_tests.bzl index 2f0613b3c73aa..4c9b3784556f4 100644 --- a/google/cloud/bigtable/bigtable_client_unit_tests.bzl +++ b/google/cloud/bigtable/bigtable_client_unit_tests.bzl @@ -42,6 +42,7 @@ bigtable_client_unit_tests = [ "internal/async_row_sampler_test.cc", "internal/async_streaming_read_test.cc", "internal/bigtable_channel_refresh_test.cc", + "internal/bigtable_random_two_least_used_decorator_test.cc", "internal/bigtable_stub_factory_test.cc", "internal/bulk_mutator_test.cc", "internal/channel_usage_test.cc", diff --git a/google/cloud/bigtable/google_cloud_cpp_bigtable.bzl b/google/cloud/bigtable/google_cloud_cpp_bigtable.bzl index 8240eba5a9fd5..e8f2fe5650641 100644 --- a/google/cloud/bigtable/google_cloud_cpp_bigtable.bzl +++ b/google/cloud/bigtable/google_cloud_cpp_bigtable.bzl @@ -74,6 +74,7 @@ google_cloud_cpp_bigtable_hdrs = [ "internal/bigtable_channel_refresh.h", "internal/bigtable_logging_decorator.h", "internal/bigtable_metadata_decorator.h", + "internal/bigtable_random_two_least_used_decorator.h", "internal/bigtable_round_robin_decorator.h", "internal/bigtable_stub.h", "internal/bigtable_stub_factory.h", @@ -190,6 +191,7 @@ google_cloud_cpp_bigtable_srcs = [ "internal/bigtable_channel_refresh.cc", "internal/bigtable_logging_decorator.cc", "internal/bigtable_metadata_decorator.cc", + "internal/bigtable_random_two_least_used_decorator.cc", "internal/bigtable_round_robin_decorator.cc", "internal/bigtable_stub.cc", "internal/bigtable_stub_factory.cc", diff --git a/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc new file mode 100644 index 0000000000000..82dff64f0cdd5 --- /dev/null +++ b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc @@ -0,0 +1,343 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h" +#include "google/cloud/internal/async_streaming_read_rpc.h" +#include "google/cloud/internal/streaming_read_rpc.h" +#include +#include +#include +#include + +namespace google { +namespace cloud { +namespace bigtable_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN +namespace { + +template +class StreamingReadRpcTracking + : public google::cloud::internal::StreamingReadRpc { + public: + StreamingReadRpcTracking( + std::unique_ptr> child, + std::function on_destruction) + : child_(std::move(child)), on_destruction_(std::move(on_destruction)) {} + + ~StreamingReadRpcTracking() override { on_destruction_(); } + + void Cancel() override { child_->Cancel(); } + std::optional Read(T* response) override { + return child_->Read(response); + } + RpcMetadata GetRequestMetadata() const override { + return child_->GetRequestMetadata(); + } + + private: + std::unique_ptr> child_; + std::function on_destruction_; +}; + +template +class AsyncStreamingReadRpcTracking + : public google::cloud::internal::AsyncStreamingReadRpc { + public: + AsyncStreamingReadRpcTracking( + std::unique_ptr> child, + std::function on_destruction) + : child_(std::move(child)), on_destruction_(std::move(on_destruction)) {} + + ~AsyncStreamingReadRpcTracking() override { on_destruction_(); } + + void Cancel() override { child_->Cancel(); } + future Start() override { return child_->Start(); } + future> Read() override { return child_->Read(); } + future Finish() override { return child_->Finish(); } + RpcMetadata GetRequestMetadata() const override { + return child_->GetRequestMetadata(); + } + + private: + std::unique_ptr> child_; + std::function on_destruction_; +}; + +template +Response UnaryHelper(std::shared_ptr>& pool, + std::function fn) { + auto child = pool->GetChannelRandomTwoLeastUsed(); + auto stub = child->AcquireStub(); + auto result = fn(*stub); + child->ReleaseStub(); + return result; +} + +template +std::unique_ptr> +StreamingHelper( + std::shared_ptr>& pool, + std::function>(BigtableStub&)> + fn) { + auto child = pool->GetChannelRandomTwoLeastUsed(); + auto stub = child->AcquireStub(); + auto result = fn(*stub); + auto release_fn = [weak = child->MakeWeak()] { + auto child = weak.lock(); + if (child) child->ReleaseStub(); + }; + return std::make_unique>( + std::move(result), std::move(release_fn)); +} + +template +std::unique_ptr> +AsyncStreamingHelper( + std::shared_ptr>& pool, + std::function>( + BigtableStub&)> + fn) { + auto child = pool->GetChannelRandomTwoLeastUsed(); + auto stub = child->AcquireStub(); + auto result = fn(*stub); + auto release_fn = [weak = child->MakeWeak()] { + auto child = weak.lock(); + if (child) child->ReleaseStub(); + }; + return std::make_unique>( + std::move(result), std::move(release_fn)); +} + +} // namespace + +std::unique_ptr> +BigtableRandomTwoLeastUsed::ReadRows( + std::shared_ptr context, Options const& options, + google::bigtable::v2::ReadRowsRequest const& request) { + return StreamingHelper( + pool_, [&, context = std::move(context)](BigtableStub& stub) mutable { + return stub.ReadRows(std::move(context), options, request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::SampleRowKeys( + std::shared_ptr context, Options const& options, + google::bigtable::v2::SampleRowKeysRequest const& request) { + return StreamingHelper( + pool_, [&, context = std::move(context)](BigtableStub& stub) mutable { + return stub.SampleRowKeys(std::move(context), options, request); + }); +} + +StatusOr +BigtableRandomTwoLeastUsed::MutateRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::MutateRowRequest const& request) { + return UnaryHelper>( + pool_, [&](BigtableStub& stub) { + return stub.MutateRow(context, options, request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::MutateRows( + std::shared_ptr context, Options const& options, + google::bigtable::v2::MutateRowsRequest const& request) { + return StreamingHelper( + pool_, [&, context = std::move(context)](BigtableStub& stub) mutable { + return stub.MutateRows(std::move(context), options, request); + }); +} + +StatusOr +BigtableRandomTwoLeastUsed::CheckAndMutateRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::CheckAndMutateRowRequest const& request) { + return UnaryHelper>( + pool_, [&](BigtableStub& stub) { + return stub.CheckAndMutateRow(context, options, request); + }); +} + +StatusOr +BigtableRandomTwoLeastUsed::PingAndWarm( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::PingAndWarmRequest const& request) { + return UnaryHelper>( + pool_, [&](BigtableStub& stub) { + return stub.PingAndWarm(context, options, request); + }); +} + +StatusOr +BigtableRandomTwoLeastUsed::ReadModifyWriteRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::ReadModifyWriteRowRequest const& request) { + return UnaryHelper< + StatusOr>( + pool_, [&](BigtableStub& stub) { + return stub.ReadModifyWriteRow(context, options, request); + }); +} + +StatusOr +BigtableRandomTwoLeastUsed::PrepareQuery( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::PrepareQueryRequest const& request) { + return UnaryHelper>( + pool_, [&](BigtableStub& stub) { + return stub.PrepareQuery(context, options, request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::ExecuteQuery( + std::shared_ptr context, Options const& options, + google::bigtable::v2::ExecuteQueryRequest const& request) { + return StreamingHelper( + pool_, [&, context = std::move(context)](BigtableStub& stub) mutable { + return stub.ExecuteQuery(std::move(context), options, request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::AsyncReadRows( + google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::ReadRowsRequest const& request) { + return AsyncStreamingHelper( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncReadRows(cq, std::move(context), std::move(options), + request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::AsyncSampleRowKeys( + google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::SampleRowKeysRequest const& request) { + return AsyncStreamingHelper( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncSampleRowKeys(cq, std::move(context), + std::move(options), request); + }); +} + +future> +BigtableRandomTwoLeastUsed::AsyncMutateRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::MutateRowRequest const& request) { + return UnaryHelper>>( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncMutateRow(cq, std::move(context), std::move(options), + request); + }); +} + +std::unique_ptr> +BigtableRandomTwoLeastUsed::AsyncMutateRows( + google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::MutateRowsRequest const& request) { + return AsyncStreamingHelper( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncMutateRows(cq, std::move(context), std::move(options), + request); + }); +} + +future> +BigtableRandomTwoLeastUsed::AsyncCheckAndMutateRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::CheckAndMutateRowRequest const& request) { + return UnaryHelper< + future>>( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncCheckAndMutateRow(cq, std::move(context), + std::move(options), request); + }); +} + +future> +BigtableRandomTwoLeastUsed::AsyncPingAndWarm( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::PingAndWarmRequest const& request) { + return UnaryHelper< + future>>( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncPingAndWarm(cq, std::move(context), std::move(options), + request); + }); +} + +future> +BigtableRandomTwoLeastUsed::AsyncReadModifyWriteRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::ReadModifyWriteRowRequest const& request) { + return UnaryHelper< + future>>( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncReadModifyWriteRow(cq, std::move(context), + std::move(options), request); + }); +} + +future> +BigtableRandomTwoLeastUsed::AsyncPrepareQuery( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::PrepareQueryRequest const& request) { + return UnaryHelper< + future>>( + pool_, [&, context = std::move(context), + options = std::move(options)](BigtableStub& stub) mutable { + return stub.AsyncPrepareQuery(cq, std::move(context), + std::move(options), request); + }); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace bigtable_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h new file mode 100644 index 0000000000000..eb6a765244a3c --- /dev/null +++ b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h @@ -0,0 +1,146 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H + +#include "google/cloud/bigtable/internal/bigtable_stub.h" +#include "google/cloud/bigtable/internal/dynamic_channel_pool.h" +#include "google/cloud/future.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace bigtable_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class BigtableRandomTwoLeastUsed : public BigtableStub { + public: + explicit BigtableRandomTwoLeastUsed( + std::shared_ptr> pool) + : pool_(std::move(pool)) {} + + ~BigtableRandomTwoLeastUsed() override = default; + + std::unique_ptr> + ReadRows(std::shared_ptr context, Options const& options, + google::bigtable::v2::ReadRowsRequest const& request) override; + + std::unique_ptr> + SampleRowKeys( + std::shared_ptr context, Options const& options, + google::bigtable::v2::SampleRowKeysRequest const& request) override; + + StatusOr MutateRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::MutateRowRequest const& request) override; + + std::unique_ptr> + MutateRows(std::shared_ptr context, + Options const& options, + google::bigtable::v2::MutateRowsRequest const& request) override; + + StatusOr CheckAndMutateRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::CheckAndMutateRowRequest const& request) override; + + StatusOr PingAndWarm( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::PingAndWarmRequest const& request) override; + + StatusOr ReadModifyWriteRow( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::ReadModifyWriteRowRequest const& request) override; + + StatusOr PrepareQuery( + grpc::ClientContext& context, Options const& options, + google::bigtable::v2::PrepareQueryRequest const& request) override; + + std::unique_ptr> + ExecuteQuery( + std::shared_ptr context, Options const& options, + google::bigtable::v2::ExecuteQueryRequest const& request) override; + + std::unique_ptr<::google::cloud::internal::AsyncStreamingReadRpc< + google::bigtable::v2::ReadRowsResponse>> + AsyncReadRows(google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::ReadRowsRequest const& request) override; + + std::unique_ptr<::google::cloud::internal::AsyncStreamingReadRpc< + google::bigtable::v2::SampleRowKeysResponse>> + AsyncSampleRowKeys( + google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::SampleRowKeysRequest const& request) override; + + future> AsyncMutateRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::MutateRowRequest const& request) override; + + std::unique_ptr<::google::cloud::internal::AsyncStreamingReadRpc< + google::bigtable::v2::MutateRowsResponse>> + AsyncMutateRows( + google::cloud::CompletionQueue const& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::MutateRowsRequest const& request) override; + + future> + AsyncCheckAndMutateRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::CheckAndMutateRowRequest const& request) override; + + future> AsyncPingAndWarm( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::PingAndWarmRequest const& request) override; + + future> + AsyncReadModifyWriteRow( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::ReadModifyWriteRowRequest const& request) override; + + future> + AsyncPrepareQuery( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::bigtable::v2::PrepareQueryRequest const& request) override; + + private: + std::shared_ptr> pool_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace bigtable_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H diff --git a/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator_test.cc b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator_test.cc new file mode 100644 index 0000000000000..0a52ba213145b --- /dev/null +++ b/google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator_test.cc @@ -0,0 +1,212 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include "google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h" +#include "google/cloud/bigtable/internal/dynamic_channel_pool.h" +#include "google/cloud/bigtable/testing/mock_bigtable_stub.h" +#include "google/cloud/testing_util/fake_completion_queue_impl.h" +#include + +namespace google { +namespace cloud { +namespace bigtable_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN +namespace { + +using ::google::cloud::bigtable::testing::MockBigtableStub; +using ::google::cloud::testing_util::FakeCompletionQueueImpl; +using ::testing::MockFunction; + +class BigtableRandomTwoLeastUsedTest : public ::testing::Test { + protected: + BigtableRandomTwoLeastUsedTest() { + mock_stub_ = std::make_shared(); + + fake_cq_impl_ = std::make_shared(); + cq_ = CompletionQueue(fake_cq_impl_); + auto instance_name = + bigtable::InstanceResource(Project("my-project"), "my-instance") + .FullName(); + DynamicChannelPoolSizingPolicy sizing_policy; + auto refresh_state = std::make_shared( + fake_cq_impl_, std::chrono::milliseconds(1), + std::chrono::milliseconds(10)); + + std::vector>> channels; + channels.push_back( + std::make_shared>(mock_stub_, 0)); + + pool_ = DynamicChannelPool::Create( + instance_name, cq_, channels, refresh_state, + stub_factory_fn_.AsStdFunction(), sizing_policy); + } + + ~BigtableRandomTwoLeastUsedTest() override { + fake_cq_impl_->SimulateCompletion(false); + } + + std::shared_ptr mock_stub_; + std::shared_ptr> pool_; + MockFunction>>( + std::uint32_t, std::string const&, StubManager::Priming)> + stub_factory_fn_; + CompletionQueue cq_; + std::shared_ptr fake_cq_impl_; +}; + +TEST_F(BigtableRandomTwoLeastUsedTest, ReadRows) { + EXPECT_CALL(*mock_stub_, ReadRows).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::ReadRowsRequest request; + auto response = decorator->ReadRows(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, SampleRowKeys) { + EXPECT_CALL(*mock_stub_, SampleRowKeys).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::SampleRowKeysRequest request; + auto response = decorator->SampleRowKeys(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, MutateRow) { + EXPECT_CALL(*mock_stub_, MutateRow).Times(1); + auto decorator = std::make_shared(pool_); + grpc::ClientContext client_context; + google::bigtable::v2::MutateRowRequest request; + auto response = decorator->MutateRow(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, MutateRows) { + EXPECT_CALL(*mock_stub_, MutateRows).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::MutateRowsRequest request; + auto response = decorator->MutateRows(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, CheckAndMutateRow) { + EXPECT_CALL(*mock_stub_, CheckAndMutateRow).Times(1); + auto decorator = std::make_shared(pool_); + grpc::ClientContext client_context; + google::bigtable::v2::CheckAndMutateRowRequest request; + auto response = decorator->CheckAndMutateRow(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, PingAndWarm) { + EXPECT_CALL(*mock_stub_, PingAndWarm).Times(1); + auto decorator = std::make_shared(pool_); + grpc::ClientContext client_context; + google::bigtable::v2::PingAndWarmRequest request; + auto response = decorator->PingAndWarm(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, ReadModifyWriteRow) { + EXPECT_CALL(*mock_stub_, ReadModifyWriteRow).Times(1); + auto decorator = std::make_shared(pool_); + grpc::ClientContext client_context; + google::bigtable::v2::ReadModifyWriteRowRequest request; + auto response = decorator->ReadModifyWriteRow(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, PrepareQuery) { + EXPECT_CALL(*mock_stub_, PrepareQuery).Times(1); + auto decorator = std::make_shared(pool_); + grpc::ClientContext client_context; + google::bigtable::v2::PrepareQueryRequest request; + auto response = decorator->PrepareQuery(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, ExecuteQuery) { + EXPECT_CALL(*mock_stub_, ExecuteQuery).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::ExecuteQueryRequest request; + auto response = decorator->ExecuteQuery(client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncReadRows) { + EXPECT_CALL(*mock_stub_, AsyncReadRows).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::ReadRowsRequest request; + auto response = decorator->AsyncReadRows(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncSampleRowKeys) { + EXPECT_CALL(*mock_stub_, AsyncSampleRowKeys).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::SampleRowKeysRequest request; + auto response = + decorator->AsyncSampleRowKeys(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncMutateRow) { + EXPECT_CALL(*mock_stub_, AsyncMutateRow).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::MutateRowRequest request; + auto response = decorator->AsyncMutateRow(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncMutateRows) { + EXPECT_CALL(*mock_stub_, AsyncMutateRows).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::MutateRowsRequest request; + auto response = decorator->AsyncMutateRows(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncCheckAndMutateRow) { + EXPECT_CALL(*mock_stub_, AsyncCheckAndMutateRow).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::CheckAndMutateRowRequest request; + auto response = + decorator->AsyncCheckAndMutateRow(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncPingAndWarm) { + EXPECT_CALL(*mock_stub_, AsyncPingAndWarm).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::PingAndWarmRequest request; + auto response = decorator->AsyncPingAndWarm(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncReadModifyWriteRow) { + EXPECT_CALL(*mock_stub_, AsyncReadModifyWriteRow).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::ReadModifyWriteRowRequest request; + auto response = + decorator->AsyncReadModifyWriteRow(cq_, client_context, {}, request); +} + +TEST_F(BigtableRandomTwoLeastUsedTest, AsyncPrepareQuery) { + EXPECT_CALL(*mock_stub_, AsyncPrepareQuery).Times(1); + auto decorator = std::make_shared(pool_); + auto client_context = std::make_shared(); + google::bigtable::v2::PrepareQueryRequest request; + auto response = + decorator->AsyncPrepareQuery(cq_, client_context, {}, request); +} + +} // namespace +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace bigtable_internal +} // namespace cloud +} // namespace google