Skip to content

Commit 30817a8

Browse files
authored
chore(bigtable): fix some formatting and auto issues (#16369)
1 parent 5a449d9 commit 30817a8

4 files changed

Lines changed: 123 additions & 156 deletions

File tree

google/cloud/bigtable/internal/bigtable_random_two_least_used_decorator.cc

Lines changed: 72 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
2828
namespace {
2929

3030
template <typename T>
31-
class StreamingReadRpcTracking
32-
: public google::cloud::internal::StreamingReadRpc<T> {
31+
class StreamingReadRpcTracking : public internal::StreamingReadRpc<T> {
3332
public:
34-
StreamingReadRpcTracking(
35-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<T>> child,
36-
std::function<void(void)> on_destruction)
33+
StreamingReadRpcTracking(std::unique_ptr<internal::StreamingReadRpc<T>> child,
34+
std::function<void()> on_destruction)
3735
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}
3836

3937
~StreamingReadRpcTracking() override { on_destruction_(); }
@@ -47,17 +45,17 @@ class StreamingReadRpcTracking
4745
}
4846

4947
private:
50-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<T>> child_;
51-
std::function<void(void)> on_destruction_;
48+
std::unique_ptr<internal::StreamingReadRpc<T>> child_;
49+
std::function<void()> on_destruction_;
5250
};
5351

5452
template <typename T>
5553
class AsyncStreamingReadRpcTracking
56-
: public google::cloud::internal::AsyncStreamingReadRpc<T> {
54+
: public internal::AsyncStreamingReadRpc<T> {
5755
public:
5856
AsyncStreamingReadRpcTracking(
59-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<T>> child,
60-
std::function<void(void)> on_destruction)
57+
std::unique_ptr<internal::AsyncStreamingReadRpc<T>> child,
58+
std::function<void()> on_destruction)
6159
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}
6260

6361
~AsyncStreamingReadRpcTracking() override { on_destruction_(); }
@@ -71,19 +69,17 @@ class AsyncStreamingReadRpcTracking
7169
}
7270

7371
private:
74-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<T>> child_;
75-
std::function<void(void)> on_destruction_;
72+
std::unique_ptr<internal::AsyncStreamingReadRpc<T>> child_;
73+
std::function<void()> on_destruction_;
7674
};
7775

7876
template <typename Request, typename Response>
7977
class AsyncStreamingReadWriteRpcTracking
80-
: public google::cloud::AsyncStreamingReadWriteRpc<Request, Response> {
78+
: public AsyncStreamingReadWriteRpc<Request, Response> {
8179
public:
8280
AsyncStreamingReadWriteRpcTracking(
83-
std::unique_ptr<
84-
google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
85-
child,
86-
std::function<void(void)> on_destruction)
81+
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>> child,
82+
std::function<void()> on_destruction)
8783
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}
8884

8985
~AsyncStreamingReadWriteRpcTracking() override { on_destruction_(); }
@@ -101,15 +97,14 @@ class AsyncStreamingReadWriteRpcTracking
10197
}
10298

10399
private:
104-
std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
105-
child_;
106-
std::function<void(void)> on_destruction_;
100+
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>> child_;
101+
std::function<void()> on_destruction_;
107102
};
108103

109104
template <typename Response>
110105
Response UnaryHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
111106
OperationContext& oc,
112-
std::function<Response(BigtableStub&)> fn) {
107+
std::function<Response(BigtableStub&)> const& fn) {
113108
SelectedChannel<BigtableStub> selection =
114109
pool->GetChannelRandomTwoLeastUsed();
115110
oc.StubSelection(StubSelectionParams{
@@ -124,7 +119,7 @@ Response UnaryHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
124119
template <typename Response>
125120
Response AsyncHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
126121
std::shared_ptr<OperationContext> const& operation_context,
127-
std::function<Response(BigtableStub&)> fn) {
122+
std::function<Response(BigtableStub&)> const& fn) {
128123
SelectedChannel<BigtableStub> selection =
129124
pool->GetChannelRandomTwoLeastUsed();
130125
if (operation_context != nullptr) {
@@ -139,13 +134,11 @@ Response AsyncHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
139134
}
140135

141136
template <typename Response>
142-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<Response>>
143-
StreamingHelper(
137+
std::unique_ptr<internal::StreamingReadRpc<Response>> StreamingHelper(
144138
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
145139
std::shared_ptr<OperationContext> const& operation_context,
146-
std::function<std::unique_ptr<
147-
google::cloud::internal::StreamingReadRpc<Response>>(BigtableStub&)>
148-
fn) {
140+
std::function<std::unique_ptr<internal::StreamingReadRpc<Response>>(
141+
BigtableStub&)> const& fn) {
149142
SelectedChannel<BigtableStub> selection =
150143
pool->GetChannelRandomTwoLeastUsed();
151144
if (operation_context != nullptr) {
@@ -164,14 +157,11 @@ StreamingHelper(
164157
}
165158

166159
template <typename Response>
167-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<Response>>
168-
AsyncStreamingHelper(
160+
std::unique_ptr<internal::AsyncStreamingReadRpc<Response>> AsyncStreamingHelper(
169161
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
170162
std::shared_ptr<OperationContext> const& operation_context,
171-
std::function<std::unique_ptr<
172-
google::cloud::internal::AsyncStreamingReadRpc<Response>>(
173-
BigtableStub&)>
174-
fn) {
163+
std::function<std::unique_ptr<internal::AsyncStreamingReadRpc<Response>>(
164+
BigtableStub&)> const& fn) {
175165
SelectedChannel<BigtableStub> selection =
176166
pool->GetChannelRandomTwoLeastUsed();
177167
if (operation_context != nullptr) {
@@ -190,13 +180,11 @@ AsyncStreamingHelper(
190180
}
191181

192182
template <typename Request, typename Response>
193-
std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
194-
AsyncStreamingHelper(
195-
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
196-
std::shared_ptr<OperationContext> const& operation_context,
197-
std::function<std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<
198-
Request, Response>>(BigtableStub&)>
199-
fn) {
183+
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>>
184+
AsyncStreamingHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
185+
std::shared_ptr<OperationContext> const& operation_context,
186+
std::function<std::unique_ptr<AsyncStreamingReadWriteRpc<
187+
Request, Response>>(BigtableStub&)> const& fn) {
200188
SelectedChannel<BigtableStub> selection =
201189
pool->GetChannelRandomTwoLeastUsed();
202190
if (operation_context != nullptr) {
@@ -218,8 +206,8 @@ AsyncStreamingHelper(
218206

219207
} // namespace
220208

221-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<
222-
google::bigtable::v2::ReadRowsResponse>>
209+
std::unique_ptr<
210+
internal::StreamingReadRpc<google::bigtable::v2::ReadRowsResponse>>
223211
BigtableRandomTwoLeastUsed::ReadRows(
224212
std::shared_ptr<grpc::ClientContext> context, Options const& options,
225213
google::bigtable::v2::ReadRowsRequest const& request,
@@ -233,8 +221,8 @@ BigtableRandomTwoLeastUsed::ReadRows(
233221
});
234222
}
235223

236-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<
237-
google::bigtable::v2::SampleRowKeysResponse>>
224+
std::unique_ptr<
225+
internal::StreamingReadRpc<google::bigtable::v2::SampleRowKeysResponse>>
238226
BigtableRandomTwoLeastUsed::SampleRowKeys(
239227
std::shared_ptr<grpc::ClientContext> context, Options const& options,
240228
google::bigtable::v2::SampleRowKeysRequest const& request,
@@ -259,8 +247,8 @@ BigtableRandomTwoLeastUsed::MutateRow(
259247
});
260248
}
261249

262-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<
263-
google::bigtable::v2::MutateRowsResponse>>
250+
std::unique_ptr<
251+
internal::StreamingReadRpc<google::bigtable::v2::MutateRowsResponse>>
264252
BigtableRandomTwoLeastUsed::MutateRows(
265253
std::shared_ptr<grpc::ClientContext> context, Options const& options,
266254
google::bigtable::v2::MutateRowsRequest const& request,
@@ -321,8 +309,8 @@ BigtableRandomTwoLeastUsed::PrepareQuery(
321309
});
322310
}
323311

324-
std::unique_ptr<google::cloud::internal::StreamingReadRpc<
325-
google::bigtable::v2::ExecuteQueryResponse>>
312+
std::unique_ptr<
313+
internal::StreamingReadRpc<google::bigtable::v2::ExecuteQueryResponse>>
326314
BigtableRandomTwoLeastUsed::ExecuteQuery(
327315
std::shared_ptr<grpc::ClientContext> context, Options const& options,
328316
google::bigtable::v2::ExecuteQueryRequest const& request,
@@ -336,12 +324,11 @@ BigtableRandomTwoLeastUsed::ExecuteQuery(
336324
});
337325
}
338326

339-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
340-
google::bigtable::v2::ReadRowsResponse>>
327+
std::unique_ptr<
328+
internal::AsyncStreamingReadRpc<google::bigtable::v2::ReadRowsResponse>>
341329
BigtableRandomTwoLeastUsed::AsyncReadRows(
342-
google::cloud::CompletionQueue const& cq,
343-
std::shared_ptr<grpc::ClientContext> context,
344-
google::cloud::internal::ImmutableOptions options,
330+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
331+
internal::ImmutableOptions options,
345332
google::bigtable::v2::ReadRowsRequest const& request,
346333
std::shared_ptr<OperationContext> operation_context) {
347334
return AsyncStreamingHelper<google::bigtable::v2::ReadRowsResponse>(
@@ -353,12 +340,11 @@ BigtableRandomTwoLeastUsed::AsyncReadRows(
353340
});
354341
}
355342

356-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
343+
std::unique_ptr<internal::AsyncStreamingReadRpc<
357344
google::bigtable::v2::SampleRowKeysResponse>>
358345
BigtableRandomTwoLeastUsed::AsyncSampleRowKeys(
359-
google::cloud::CompletionQueue const& cq,
360-
std::shared_ptr<grpc::ClientContext> context,
361-
google::cloud::internal::ImmutableOptions options,
346+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
347+
internal::ImmutableOptions options,
362348
google::bigtable::v2::SampleRowKeysRequest const& request,
363349
std::shared_ptr<OperationContext> operation_context) {
364350
return AsyncStreamingHelper<google::bigtable::v2::SampleRowKeysResponse>(
@@ -373,9 +359,8 @@ BigtableRandomTwoLeastUsed::AsyncSampleRowKeys(
373359

374360
future<StatusOr<google::bigtable::v2::MutateRowResponse>>
375361
BigtableRandomTwoLeastUsed::AsyncMutateRow(
376-
google::cloud::CompletionQueue& cq,
377-
std::shared_ptr<grpc::ClientContext> context,
378-
google::cloud::internal::ImmutableOptions options,
362+
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
363+
internal::ImmutableOptions options,
379364
google::bigtable::v2::MutateRowRequest const& request,
380365
std::shared_ptr<OperationContext> operation_context) {
381366
return AsyncHelper<future<StatusOr<google::bigtable::v2::MutateRowResponse>>>(
@@ -387,12 +372,11 @@ BigtableRandomTwoLeastUsed::AsyncMutateRow(
387372
});
388373
}
389374

390-
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
391-
google::bigtable::v2::MutateRowsResponse>>
375+
std::unique_ptr<
376+
internal::AsyncStreamingReadRpc<google::bigtable::v2::MutateRowsResponse>>
392377
BigtableRandomTwoLeastUsed::AsyncMutateRows(
393-
google::cloud::CompletionQueue const& cq,
394-
std::shared_ptr<grpc::ClientContext> context,
395-
google::cloud::internal::ImmutableOptions options,
378+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
379+
internal::ImmutableOptions options,
396380
google::bigtable::v2::MutateRowsRequest const& request,
397381
std::shared_ptr<OperationContext> operation_context) {
398382
return AsyncStreamingHelper<google::bigtable::v2::MutateRowsResponse>(
@@ -406,9 +390,8 @@ BigtableRandomTwoLeastUsed::AsyncMutateRows(
406390

407391
future<StatusOr<google::bigtable::v2::CheckAndMutateRowResponse>>
408392
BigtableRandomTwoLeastUsed::AsyncCheckAndMutateRow(
409-
google::cloud::CompletionQueue& cq,
410-
std::shared_ptr<grpc::ClientContext> context,
411-
google::cloud::internal::ImmutableOptions options,
393+
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
394+
internal::ImmutableOptions options,
412395
google::bigtable::v2::CheckAndMutateRowRequest const& request,
413396
std::shared_ptr<OperationContext> operation_context) {
414397
return AsyncHelper<
@@ -424,9 +407,8 @@ BigtableRandomTwoLeastUsed::AsyncCheckAndMutateRow(
424407

425408
future<StatusOr<google::bigtable::v2::PingAndWarmResponse>>
426409
BigtableRandomTwoLeastUsed::AsyncPingAndWarm(
427-
google::cloud::CompletionQueue& cq,
428-
std::shared_ptr<grpc::ClientContext> context,
429-
google::cloud::internal::ImmutableOptions options,
410+
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
411+
internal::ImmutableOptions options,
430412
google::bigtable::v2::PingAndWarmRequest const& request,
431413
std::shared_ptr<OperationContext> operation_context) {
432414
return AsyncHelper<
@@ -441,9 +423,8 @@ BigtableRandomTwoLeastUsed::AsyncPingAndWarm(
441423

442424
future<StatusOr<google::bigtable::v2::ReadModifyWriteRowResponse>>
443425
BigtableRandomTwoLeastUsed::AsyncReadModifyWriteRow(
444-
google::cloud::CompletionQueue& cq,
445-
std::shared_ptr<grpc::ClientContext> context,
446-
google::cloud::internal::ImmutableOptions options,
426+
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
427+
internal::ImmutableOptions options,
447428
google::bigtable::v2::ReadModifyWriteRowRequest const& request,
448429
std::shared_ptr<OperationContext> operation_context) {
449430
return AsyncHelper<
@@ -459,9 +440,8 @@ BigtableRandomTwoLeastUsed::AsyncReadModifyWriteRow(
459440

460441
future<StatusOr<google::bigtable::v2::PrepareQueryResponse>>
461442
BigtableRandomTwoLeastUsed::AsyncPrepareQuery(
462-
google::cloud::CompletionQueue& cq,
463-
std::shared_ptr<grpc::ClientContext> context,
464-
google::cloud::internal::ImmutableOptions options,
443+
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
444+
internal::ImmutableOptions options,
465445
google::bigtable::v2::PrepareQueryRequest const& request,
466446
std::shared_ptr<OperationContext> operation_context) {
467447
return AsyncHelper<
@@ -487,13 +467,12 @@ BigtableRandomTwoLeastUsed::GetClientConfiguration(
487467
});
488468
}
489469

490-
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
491-
google::bigtable::v2::SessionRequest,
492-
google::bigtable::v2::SessionResponse>>
470+
std::unique_ptr<
471+
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
472+
google::bigtable::v2::SessionResponse>>
493473
BigtableRandomTwoLeastUsed::AsyncOpenTable(
494-
google::cloud::CompletionQueue const& cq,
495-
std::shared_ptr<grpc::ClientContext> context,
496-
google::cloud::internal::ImmutableOptions options,
474+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
475+
internal::ImmutableOptions options,
497476
std::shared_ptr<OperationContext> operation_context) {
498477
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
499478
google::bigtable::v2::SessionResponse>(
@@ -505,13 +484,12 @@ BigtableRandomTwoLeastUsed::AsyncOpenTable(
505484
});
506485
}
507486

508-
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
509-
google::bigtable::v2::SessionRequest,
510-
google::bigtable::v2::SessionResponse>>
487+
std::unique_ptr<
488+
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
489+
google::bigtable::v2::SessionResponse>>
511490
BigtableRandomTwoLeastUsed::AsyncOpenAuthorizedView(
512-
google::cloud::CompletionQueue const& cq,
513-
std::shared_ptr<grpc::ClientContext> context,
514-
google::cloud::internal::ImmutableOptions options,
491+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
492+
internal::ImmutableOptions options,
515493
std::shared_ptr<OperationContext> operation_context) {
516494
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
517495
google::bigtable::v2::SessionResponse>(
@@ -524,13 +502,12 @@ BigtableRandomTwoLeastUsed::AsyncOpenAuthorizedView(
524502
});
525503
}
526504

527-
std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
528-
google::bigtable::v2::SessionRequest,
529-
google::bigtable::v2::SessionResponse>>
505+
std::unique_ptr<
506+
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
507+
google::bigtable::v2::SessionResponse>>
530508
BigtableRandomTwoLeastUsed::AsyncOpenMaterializedView(
531-
google::cloud::CompletionQueue const& cq,
532-
std::shared_ptr<grpc::ClientContext> context,
533-
google::cloud::internal::ImmutableOptions options,
509+
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
510+
internal::ImmutableOptions options,
534511
std::shared_ptr<OperationContext> operation_context) {
535512
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
536513
google::bigtable::v2::SessionResponse>(

0 commit comments

Comments
 (0)