Skip to content

Commit 0423bfa

Browse files
authored
impl(bigtable): update DataConnectionImpl to create and call OperationContext hooks (#15320)
1 parent d36fb50 commit 0423bfa

File tree

8 files changed

+1299
-118
lines changed

8 files changed

+1299
-118
lines changed

google/cloud/bigtable/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ if (BUILD_TESTING)
456456
internal/logging_data_client_test.cc
457457
internal/metrics_test.cc
458458
internal/mutate_rows_limiter_test.cc
459+
internal/operation_context_factory_test.cc
459460
internal/operation_context_test.cc
460461
internal/prefix_range_end_test.cc
461462
internal/rate_limiter_test.cc

google/cloud/bigtable/bigtable_client_unit_tests.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ bigtable_client_unit_tests = [
6161
"internal/logging_data_client_test.cc",
6262
"internal/metrics_test.cc",
6363
"internal/mutate_rows_limiter_test.cc",
64+
"internal/operation_context_factory_test.cc",
6465
"internal/operation_context_test.cc",
6566
"internal/prefix_range_end_test.cc",
6667
"internal/rate_limiter_test.cc",

google/cloud/bigtable/internal/data_connection_impl.cc

Lines changed: 112 additions & 43 deletions
Large diffs are not rendered by default.

google/cloud/bigtable/internal/data_connection_impl.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ class DataConnectionImpl : public bigtable::DataConnection {
4242
std::shared_ptr<MutateRowsLimiter> limiter,
4343
Options options);
4444

45+
// This constructor is used for testing.
46+
DataConnectionImpl(
47+
std::unique_ptr<BackgroundThreads> background,
48+
std::shared_ptr<BigtableStub> stub,
49+
std::unique_ptr<OperationContextFactory> operation_context_factory,
50+
std::shared_ptr<MutateRowsLimiter> limiter, Options options);
51+
4552
Options options() override { return options_; }
4653

4754
Status Apply(std::string const& table_name,
@@ -95,9 +102,17 @@ class DataConnectionImpl : public bigtable::DataConnection {
95102
bigtable::Filter filter) override;
96103

97104
private:
98-
std::unique_ptr<OperationContextFactory> operation_context_factory_;
105+
void AsyncReadRowsHelper(std::string const& table_name,
106+
std::function<future<bool>(bigtable::Row)> on_row,
107+
std::function<void(Status)> on_finish,
108+
bigtable::RowSet row_set, std::int64_t rows_limit,
109+
bigtable::Filter filter,
110+
internal::ImmutableOptions const& current,
111+
std::shared_ptr<OperationContext> operation_context);
112+
99113
std::unique_ptr<BackgroundThreads> background_;
100114
std::shared_ptr<BigtableStub> stub_;
115+
std::unique_ptr<OperationContextFactory> operation_context_factory_;
101116
std::shared_ptr<MutateRowsLimiter> limiter_;
102117
Options options_;
103118
};

0 commit comments

Comments
 (0)