Skip to content

Commit ed74a3e

Browse files
committed
refactor(bigtable): reorganize query public types and files
1 parent 601c5b8 commit ed74a3e

18 files changed

+876
-771
lines changed

google/cloud/bigtable/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ add_library(
249249
read_modify_write_rule.h
250250
resource_names.cc
251251
resource_names.h
252-
results.h
252+
result_source_interface.h
253253
retry_policy.h
254254
row.h
255255
row_key.h
@@ -260,6 +260,8 @@ add_library(
260260
row_reader.h
261261
row_set.cc
262262
row_set.h
263+
row_stream.cc
264+
row_stream.h
263265
rpc_backoff_policy.cc
264266
rpc_backoff_policy.h
265267
rpc_retry_policy.cc
@@ -511,6 +513,7 @@ if (BUILD_TESTING)
511513
row_range_test.cc
512514
row_reader_test.cc
513515
row_set_test.cc
516+
row_stream_test.cc
514517
row_test.cc
515518
rpc_backoff_policy_test.cc
516519
rpc_retry_policy_test.cc

google/cloud/bigtable/bigtable_client_unit_tests.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ bigtable_client_unit_tests = [
8787
"row_range_test.cc",
8888
"row_reader_test.cc",
8989
"row_set_test.cc",
90+
"row_stream_test.cc",
9091
"row_test.cc",
9192
"rpc_backoff_policy_test.cc",
9293
"rpc_retry_policy_test.cc",

google/cloud/bigtable/data_connection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "google/cloud/bigtable/internal/partial_result_set_source.h"
2222
#include "google/cloud/bigtable/internal/row_reader_impl.h"
2323
#include "google/cloud/bigtable/options.h"
24-
#include "google/cloud/bigtable/results.h"
24+
#include "google/cloud/bigtable/result_source_interface.h"
2525
#include "google/cloud/background_threads.h"
2626
#include "google/cloud/common_options.h"
2727
#include "google/cloud/credentials.h"

google/cloud/bigtable/data_connection.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020
#include "google/cloud/bigtable/mutation_branch.h"
2121
#include "google/cloud/bigtable/mutations.h"
2222
#include "google/cloud/bigtable/prepared_query.h"
23-
#include "google/cloud/bigtable/results.h"
23+
#include "google/cloud/bigtable/result_source_interface.h"
2424
#include "google/cloud/bigtable/row.h"
2525
#include "google/cloud/bigtable/row_key_sample.h"
2626
#include "google/cloud/bigtable/row_reader.h"
2727
#include "google/cloud/bigtable/row_set.h"
28+
#include "google/cloud/bigtable/row_stream.h"
2829
#include "google/cloud/bigtable/sql_statement.h"
2930
#include "google/cloud/backoff_policy.h"
3031
#include "google/cloud/options.h"

google/cloud/bigtable/google_cloud_cpp_bigtable.bzl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ google_cloud_cpp_bigtable_hdrs = [
128128
"query_row.h",
129129
"read_modify_write_rule.h",
130130
"resource_names.h",
131-
"results.h",
131+
"result_source_interface.h",
132132
"retry_policy.h",
133133
"row.h",
134134
"row_key.h",
135135
"row_key_sample.h",
136136
"row_range.h",
137137
"row_reader.h",
138138
"row_set.h",
139+
"row_stream.h",
139140
"rpc_backoff_policy.h",
140141
"rpc_retry_policy.h",
141142
"sql_statement.h",
@@ -240,6 +241,7 @@ google_cloud_cpp_bigtable_srcs = [
240241
"row_range.cc",
241242
"row_reader.cc",
242243
"row_set.cc",
244+
"row_stream.cc",
243245
"rpc_backoff_policy.cc",
244246
"rpc_retry_policy.cc",
245247
"sql_statement.cc",

google/cloud/bigtable/internal/data_connection_impl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "google/cloud/bigtable/internal/retry_traits.h"
2828
#include "google/cloud/bigtable/internal/rpc_policy_parameters.h"
2929
#include "google/cloud/bigtable/options.h"
30-
#include "google/cloud/bigtable/results.h"
30+
#include "google/cloud/bigtable/result_source_interface.h"
3131
#include "google/cloud/bigtable/retry_policy.h"
3232
#include "google/cloud/background_threads.h"
3333
#include "google/cloud/grpc_options.h"

google/cloud/bigtable/internal/data_connection_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "google/cloud/bigtable/internal/operation_context_factory.h"
2222
#include "google/cloud/bigtable/internal/partial_result_set_reader.h"
2323
#include "google/cloud/bigtable/prepared_query.h"
24-
#include "google/cloud/bigtable/results.h"
24+
#include "google/cloud/bigtable/result_source_interface.h"
2525
#include "google/cloud/background_threads.h"
2626
#include "google/cloud/options.h"
2727
#include "google/cloud/status_or.h"

google/cloud/bigtable/internal/partial_result_set_source.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "google/cloud/bigtable/internal/operation_context.h"
1919
#include "google/cloud/bigtable/internal/partial_result_set_reader.h"
20-
#include "google/cloud/bigtable/results.h"
20+
#include "google/cloud/bigtable/result_source_interface.h"
2121
#include "google/cloud/bigtable/value.h"
2222
#include "google/cloud/bigtable/version.h"
2323
#include "google/cloud/options.h"

google/cloud/bigtable/query_row.cc

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,6 @@ bool operator==(QueryRow const& a, QueryRow const& b) {
6565
return a.values_ == b.values_ && *a.columns_ == *b.columns_;
6666
}
6767

68-
//
69-
// RowStreamIterator
70-
//
71-
72-
RowStreamIterator::RowStreamIterator() = default;
73-
74-
RowStreamIterator::RowStreamIterator(Source source)
75-
: source_(std::move(source)) {
76-
++*this;
77-
}
78-
79-
RowStreamIterator& RowStreamIterator::operator++() {
80-
if (!row_ok_) {
81-
source_ = nullptr; // Last row was an error; become "end"
82-
return *this;
83-
}
84-
row_ = source_();
85-
row_ok_ = row_.ok();
86-
if (row_ && row_->size() == 0) {
87-
source_ = nullptr; // No more Rows to consume; become "end"
88-
return *this;
89-
}
90-
return *this;
91-
}
92-
93-
RowStreamIterator RowStreamIterator::operator++(int) {
94-
auto old = *this;
95-
++*this;
96-
return old;
97-
}
98-
99-
bool operator==(RowStreamIterator const& a, RowStreamIterator const& b) {
100-
// Input iterators may only be compared to (copies of) themselves and end.
101-
// See https://en.cppreference.com/w/cpp/named_req/InputIterator. Therefore,
102-
// by definition, all input iterators are equal unless one is end and the
103-
// other is not.
104-
return !a.source_ == !b.source_;
105-
}
106-
107-
bool operator!=(RowStreamIterator const& a, RowStreamIterator const& b) {
108-
return !(a == b);
109-
}
110-
11168
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
11269
} // namespace bigtable
11370
} // namespace cloud

0 commit comments

Comments
 (0)