Skip to content

Commit 56534d1

Browse files
committed
rename and move new files
1 parent 4b11b16 commit 56534d1

12 files changed

+33
-53
lines changed

google/cloud/bigtable/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ add_library(
166166
internal/bigtable_logging_decorator.h
167167
internal/bigtable_metadata_decorator.cc
168168
internal/bigtable_metadata_decorator.h
169-
internal/bigtable_random_two_least_used_decorator.cc
170-
internal/bigtable_random_two_least_used_decorator.h
171169
internal/bigtable_round_robin_decorator.cc
172170
internal/bigtable_round_robin_decorator.h
173171
internal/bigtable_stub.cc
@@ -196,6 +194,8 @@ add_library(
196194
internal/default_row_reader.h
197195
internal/defaults.cc
198196
internal/defaults.h
197+
internal/dynamic_channel_pool.cc
198+
internal/dynamic_channel_pool.h
199199
internal/google_bytes_traits.cc
200200
internal/google_bytes_traits.h
201201
internal/legacy_async_bulk_apply.cc
@@ -227,6 +227,8 @@ add_library(
227227
internal/prefix_range_end.h
228228
internal/query_plan.cc
229229
internal/query_plan.h
230+
internal/random_two_least_used_decorator.cc
231+
internal/random_two_least_used_decorator.h
230232
internal/rate_limiter.cc
231233
internal/rate_limiter.h
232234
internal/readrowsparser.cc
@@ -493,6 +495,7 @@ if (BUILD_TESTING)
493495
internal/data_tracing_connection_test.cc
494496
internal/default_row_reader_test.cc
495497
internal/defaults_test.cc
498+
internal/dynamic_channel_pool_test.cc
496499
internal/google_bytes_traits_test.cc
497500
internal/legacy_async_bulk_apply_test.cc
498501
internal/legacy_async_row_reader_test.cc

google/cloud/bigtable/bigtable_client_unit_tests.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bigtable_client_unit_tests = [
5656
"internal/data_tracing_connection_test.cc",
5757
"internal/default_row_reader_test.cc",
5858
"internal/defaults_test.cc",
59+
"internal/dynamic_channel_pool_test.cc",
5960
"internal/google_bytes_traits_test.cc",
6061
"internal/legacy_async_bulk_apply_test.cc",
6162
"internal/legacy_async_row_reader_test.cc",

google/cloud/bigtable/google_cloud_cpp_bigtable.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ google_cloud_cpp_bigtable_hdrs = [
8080
"internal/bigtable_channel_refresh.h",
8181
"internal/bigtable_logging_decorator.h",
8282
"internal/bigtable_metadata_decorator.h",
83-
"internal/bigtable_random_two_least_used_decorator.h",
8483
"internal/bigtable_round_robin_decorator.h",
8584
"internal/bigtable_stub.h",
8685
"internal/bigtable_stub_factory.h",
@@ -96,6 +95,7 @@ google_cloud_cpp_bigtable_hdrs = [
9695
"internal/data_tracing_connection.h",
9796
"internal/default_row_reader.h",
9897
"internal/defaults.h",
98+
"internal/dynamic_channel_pool.h",
9999
"internal/google_bytes_traits.h",
100100
"internal/legacy_async_bulk_apply.h",
101101
"internal/legacy_async_row_reader.h",
@@ -112,6 +112,7 @@ google_cloud_cpp_bigtable_hdrs = [
112112
"internal/partial_result_set_source.h",
113113
"internal/prefix_range_end.h",
114114
"internal/query_plan.h",
115+
"internal/random_two_least_used_decorator.h",
115116
"internal/rate_limiter.h",
116117
"internal/readrowsparser.h",
117118
"internal/retry_traits.h",
@@ -205,7 +206,6 @@ google_cloud_cpp_bigtable_srcs = [
205206
"internal/bigtable_channel_refresh.cc",
206207
"internal/bigtable_logging_decorator.cc",
207208
"internal/bigtable_metadata_decorator.cc",
208-
"internal/bigtable_random_two_least_used_decorator.cc",
209209
"internal/bigtable_round_robin_decorator.cc",
210210
"internal/bigtable_stub.cc",
211211
"internal/bigtable_stub_factory.cc",
@@ -219,6 +219,7 @@ google_cloud_cpp_bigtable_srcs = [
219219
"internal/data_tracing_connection.cc",
220220
"internal/default_row_reader.cc",
221221
"internal/defaults.cc",
222+
"internal/dynamic_channel_pool.cc",
222223
"internal/google_bytes_traits.cc",
223224
"internal/legacy_async_bulk_apply.cc",
224225
"internal/legacy_async_row_reader.cc",
@@ -234,6 +235,7 @@ google_cloud_cpp_bigtable_srcs = [
234235
"internal/partial_result_set_source.cc",
235236
"internal/prefix_range_end.cc",
236237
"internal/query_plan.cc",
238+
"internal/random_two_least_used_decorator.cc",
237239
"internal/rate_limiter.cc",
238240
"internal/readrowsparser.cc",
239241
"internal/retry_traits.cc",

google/cloud/bigtable/internal/bigtable_stub_factory.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#include "google/cloud/bigtable/internal/bigtable_channel_refresh.h"
1818
#include "google/cloud/bigtable/internal/bigtable_logging_decorator.h"
1919
#include "google/cloud/bigtable/internal/bigtable_metadata_decorator.h"
20-
#include "google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h"
2120
#include "google/cloud/bigtable/internal/bigtable_round_robin_decorator.h"
2221
#include "google/cloud/bigtable/internal/bigtable_tracing_stub.h"
2322
#include "google/cloud/bigtable/internal/connection_refresh_state.h"
23+
#include "google/cloud/bigtable/internal/random_two_least_used_decorator.h"
2424
#include "google/cloud/bigtable/options.h"
2525
#include "google/cloud/common_options.h"
2626
#include "google/cloud/grpc_options.h"

google/cloud/internal/channel_pool.cc renamed to google/cloud/bigtable/internal/dynamic_channel_pool.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "google/cloud/internal/channel_pool.h"
15+
#include "google/cloud/bigtable/internal/dynamic_channel_pool.h"
1616
#include "google/cloud/version.h"
1717

1818
namespace google {
1919
namespace cloud {
20+
namespace bigtable_internal {
2021
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2122
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
23+
} // namespace bigtable_internal
2224
} // namespace cloud
2325
} // namespace google

google/cloud/internal/channel_pool.h renamed to google/cloud/bigtable/internal/dynamic_channel_pool.h

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CHANNEL_POOL_H
16-
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CHANNEL_POOL_H
15+
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_DYNAMIC_CHANNEL_POOL_H
16+
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_DYNAMIC_CHANNEL_POOL_H
1717

1818
#include "google/cloud/completion_queue.h"
1919
#include "google/cloud/internal/random.h"
@@ -26,8 +26,8 @@
2626

2727
namespace google {
2828
namespace cloud {
29+
namespace bigtable_internal {
2930
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
30-
namespace internal {
3131

3232
template <typename T>
3333
class StubUsageWrapper
@@ -63,18 +63,6 @@ class StubUsageWrapper
6363
int outstanding_rpcs_ = 0;
6464
};
6565

66-
template <typename T>
67-
class StaticChannelPool {
68-
public:
69-
explicit StaticChannelPool(std::size_t size);
70-
71-
std::shared_ptr<T> GetChannel();
72-
std::shared_ptr<T> GetChannel(std::size_t index);
73-
74-
private:
75-
std::vector<T> channels_;
76-
};
77-
7866
template <typename T>
7967
class DynamicChannelPool
8068
: public std::enable_shared_from_this<DynamicChannelPool<T>> {
@@ -138,18 +126,6 @@ class DynamicChannelPool
138126
return channels_.size();
139127
}
140128

141-
// std::shared_ptr<StubUsageWrapper<T>> GetChannel(
142-
// std::unique_lock<std::mutex> const&) {
143-
// // TODO: check for empty
144-
// return channels_[0];
145-
// }
146-
//
147-
// std::shared_ptr<StubUsageWrapper<T>> GetChannel(
148-
// std::unique_lock<std::mutex> const&, std::size_t index) {
149-
// // TODO: bounds check
150-
// return channels_[index];
151-
// }
152-
153129
std::shared_ptr<StubUsageWrapper<T>> GetChannelRandomTwoLeastUsed() {
154130
std::unique_lock<std::mutex> lk(mu_);
155131
std::cout << __PRETTY_FUNCTION__ << ": channels_size()=" << channels_.size()
@@ -333,9 +309,9 @@ class DynamicChannelPool
333309
int next_channel_id_;
334310
};
335311

336-
} // namespace internal
337312
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
313+
} // namespace bigtable_internal
338314
} // namespace cloud
339315
} // namespace google
340316

341-
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_INTERNAL_CHANNEL_POOL_H
317+
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_DYNAMIC_CHANNEL_POOL_H

google/cloud/internal/channel_pool_test.cc renamed to google/cloud/bigtable/internal/dynamic_channel_pool_test.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
#include "google/cloud/internal/channel_pool.h"
15+
#include "google/cloud/bigtable/internal/dynamic_channel_pool.h"
1616
#include "google/cloud/testing_util/status_matchers.h"
1717
#include <gmock/gmock.h>
1818

1919
namespace google {
2020
namespace cloud {
21+
namespace bigtable_internal {
2122
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2223
namespace internal {} // namespace internal
2324
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
25+
} // namespace bigtable_internal
2426
} // namespace cloud
2527
} // namespace google

google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc renamed to google/cloud/bigtable/internal/random_two_least_used_decorator.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// If you make any local changes, they will be lost.
1717
// source: google/bigtable/v2/bigtable.proto
1818

19-
#include "google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h"
19+
#include "google/cloud/bigtable/internal/random_two_least_used_decorator.h"
2020
#include <memory>
2121
#include <mutex>
2222
#include <vector>
@@ -79,10 +79,10 @@ class AsyncStreamingReadRpcTracking
7979

8080
BigtableRandomTwoLeastUsed::BigtableRandomTwoLeastUsed(
8181
CompletionQueue cq,
82-
internal::DynamicChannelPool<BigtableStub>::StubFactoryFn
82+
DynamicChannelPool<BigtableStub>::StubFactoryFn
8383
refreshing_channel_stub_factory_fn,
8484
std::vector<std::shared_ptr<BigtableStub>> children)
85-
: pool_(internal::DynamicChannelPool<BigtableStub>::Create(
85+
: pool_(DynamicChannelPool<BigtableStub>::Create(
8686
std::move(cq), std::move(children),
8787
std::move(refreshing_channel_stub_factory_fn))) {}
8888

@@ -328,7 +328,7 @@ BigtableRandomTwoLeastUsed::AsyncPrepareQuery(
328328
return result;
329329
}
330330

331-
std::shared_ptr<internal::StubUsageWrapper<BigtableStub>>
331+
std::shared_ptr<StubUsageWrapper<BigtableStub>>
332332
BigtableRandomTwoLeastUsed::Child() {
333333
std::cout << __PRETTY_FUNCTION__ << std::endl;
334334
return pool_->GetChannelRandomTwoLeastUsed();

google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.h renamed to google/cloud/bigtable/internal/random_two_least_used_decorator.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
// If you make any local changes, they will be lost.
1717
// source: google/bigtable/v2/bigtable.proto
1818

19-
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H
20-
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H
19+
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_RANDOM_TWO_LEAST_USED_DECORATOR_H
20+
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_RANDOM_TWO_LEAST_USED_DECORATOR_H
2121

2222
#include "google/cloud/bigtable/internal/bigtable_stub.h"
23-
#include "google/cloud/internal/channel_pool.h"
23+
#include "google/cloud/bigtable/internal/dynamic_channel_pool.h"
2424
#include "google/cloud/version.h"
2525
#include <memory>
2626
#include <mutex>
@@ -35,7 +35,7 @@ class BigtableRandomTwoLeastUsed : public BigtableStub {
3535
public:
3636
BigtableRandomTwoLeastUsed(
3737
CompletionQueue cq,
38-
internal::DynamicChannelPool<BigtableStub>::StubFactoryFn
38+
DynamicChannelPool<BigtableStub>::StubFactoryFn
3939
refreshing_channel_stub_factory_fn,
4040
std::vector<std::shared_ptr<BigtableStub>> children);
4141
~BigtableRandomTwoLeastUsed() override = default;
@@ -134,15 +134,15 @@ class BigtableRandomTwoLeastUsed : public BigtableStub {
134134
google::bigtable::v2::PrepareQueryRequest const& request) override;
135135

136136
private:
137-
std::shared_ptr<internal::StubUsageWrapper<BigtableStub>> Child();
137+
std::shared_ptr<StubUsageWrapper<BigtableStub>> Child();
138138

139139
// std::mutex mu_;
140-
std::shared_ptr<internal::DynamicChannelPool<BigtableStub>> pool_;
140+
std::shared_ptr<DynamicChannelPool<BigtableStub>> pool_;
141141
};
142142

143143
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
144144
} // namespace bigtable_internal
145145
} // namespace cloud
146146
} // namespace google
147147

148-
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_BIGTABLE_RANDOM_TWO_LEAST_USED_DECORATOR_H
148+
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_BIGTABLE_INTERNAL_RANDOM_TWO_LEAST_USED_DECORATOR_H

google/cloud/google_cloud_cpp_grpc_utils.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ google_cloud_cpp_grpc_utils_hdrs = [
5454
"internal/async_streaming_write_rpc_timeout.h",
5555
"internal/async_streaming_write_rpc_tracing.h",
5656
"internal/background_threads_impl.h",
57-
"internal/channel_pool.h",
5857
"internal/completion_queue_impl.h",
5958
"internal/debug_string_protobuf.h",
6059
"internal/debug_string_status.h",
@@ -96,7 +95,6 @@ google_cloud_cpp_grpc_utils_srcs = [
9695
"internal/async_connection_ready.cc",
9796
"internal/async_polling_loop.cc",
9897
"internal/background_threads_impl.cc",
99-
"internal/channel_pool.cc",
10098
"internal/debug_string_protobuf.cc",
10199
"internal/debug_string_status.cc",
102100
"internal/default_completion_queue_impl.cc",

0 commit comments

Comments
 (0)