Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
namespace {

template <typename T>
class StreamingReadRpcTracking
: public google::cloud::internal::StreamingReadRpc<T> {
class StreamingReadRpcTracking : public internal::StreamingReadRpc<T> {
public:
StreamingReadRpcTracking(
std::unique_ptr<google::cloud::internal::StreamingReadRpc<T>> child,
std::function<void(void)> on_destruction)
StreamingReadRpcTracking(std::unique_ptr<internal::StreamingReadRpc<T>> child,
std::function<void()> on_destruction)
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}

~StreamingReadRpcTracking() override { on_destruction_(); }
Expand All @@ -47,17 +45,17 @@ class StreamingReadRpcTracking
}

private:
std::unique_ptr<google::cloud::internal::StreamingReadRpc<T>> child_;
std::function<void(void)> on_destruction_;
std::unique_ptr<internal::StreamingReadRpc<T>> child_;
std::function<void()> on_destruction_;
};

template <typename T>
class AsyncStreamingReadRpcTracking
: public google::cloud::internal::AsyncStreamingReadRpc<T> {
: public internal::AsyncStreamingReadRpc<T> {
public:
AsyncStreamingReadRpcTracking(
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<T>> child,
std::function<void(void)> on_destruction)
std::unique_ptr<internal::AsyncStreamingReadRpc<T>> child,
std::function<void()> on_destruction)
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}

~AsyncStreamingReadRpcTracking() override { on_destruction_(); }
Expand All @@ -71,19 +69,17 @@ class AsyncStreamingReadRpcTracking
}

private:
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<T>> child_;
std::function<void(void)> on_destruction_;
std::unique_ptr<internal::AsyncStreamingReadRpc<T>> child_;
std::function<void()> on_destruction_;
};

template <typename Request, typename Response>
class AsyncStreamingReadWriteRpcTracking
: public google::cloud::AsyncStreamingReadWriteRpc<Request, Response> {
: public AsyncStreamingReadWriteRpc<Request, Response> {
public:
AsyncStreamingReadWriteRpcTracking(
std::unique_ptr<
google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
child,
std::function<void(void)> on_destruction)
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>> child,
std::function<void()> on_destruction)
: child_(std::move(child)), on_destruction_(std::move(on_destruction)) {}

~AsyncStreamingReadWriteRpcTracking() override { on_destruction_(); }
Expand All @@ -101,15 +97,14 @@ class AsyncStreamingReadWriteRpcTracking
}

private:
std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
child_;
std::function<void(void)> on_destruction_;
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>> child_;
std::function<void()> on_destruction_;
};

template <typename Response>
Response UnaryHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
OperationContext& oc,
std::function<Response(BigtableStub&)> fn) {
std::function<Response(BigtableStub&)> const& fn) {
SelectedChannel<BigtableStub> selection =
pool->GetChannelRandomTwoLeastUsed();
oc.StubSelection(StubSelectionParams{
Expand All @@ -124,7 +119,7 @@ Response UnaryHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
template <typename Response>
Response AsyncHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
std::shared_ptr<OperationContext> const& operation_context,
std::function<Response(BigtableStub&)> fn) {
std::function<Response(BigtableStub&)> const& fn) {
SelectedChannel<BigtableStub> selection =
pool->GetChannelRandomTwoLeastUsed();
if (operation_context != nullptr) {
Expand All @@ -139,13 +134,11 @@ Response AsyncHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
}

template <typename Response>
std::unique_ptr<google::cloud::internal::StreamingReadRpc<Response>>
StreamingHelper(
std::unique_ptr<internal::StreamingReadRpc<Response>> StreamingHelper(
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
std::shared_ptr<OperationContext> const& operation_context,
std::function<std::unique_ptr<
google::cloud::internal::StreamingReadRpc<Response>>(BigtableStub&)>
fn) {
std::function<std::unique_ptr<internal::StreamingReadRpc<Response>>(
BigtableStub&)> const& fn) {
SelectedChannel<BigtableStub> selection =
pool->GetChannelRandomTwoLeastUsed();
if (operation_context != nullptr) {
Expand All @@ -164,14 +157,11 @@ StreamingHelper(
}

template <typename Response>
std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<Response>>
AsyncStreamingHelper(
std::unique_ptr<internal::AsyncStreamingReadRpc<Response>> AsyncStreamingHelper(
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
std::shared_ptr<OperationContext> const& operation_context,
std::function<std::unique_ptr<
google::cloud::internal::AsyncStreamingReadRpc<Response>>(
BigtableStub&)>
fn) {
std::function<std::unique_ptr<internal::AsyncStreamingReadRpc<Response>>(
BigtableStub&)> const& fn) {
SelectedChannel<BigtableStub> selection =
pool->GetChannelRandomTwoLeastUsed();
if (operation_context != nullptr) {
Expand All @@ -190,13 +180,11 @@ AsyncStreamingHelper(
}

template <typename Request, typename Response>
std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<Request, Response>>
AsyncStreamingHelper(
std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
std::shared_ptr<OperationContext> const& operation_context,
std::function<std::unique_ptr<google::cloud::AsyncStreamingReadWriteRpc<
Request, Response>>(BigtableStub&)>
fn) {
std::unique_ptr<AsyncStreamingReadWriteRpc<Request, Response>>
AsyncStreamingHelper(std::shared_ptr<DynamicChannelPool<BigtableStub>>& pool,
std::shared_ptr<OperationContext> const& operation_context,
std::function<std::unique_ptr<AsyncStreamingReadWriteRpc<
Request, Response>>(BigtableStub&)> const& fn) {
SelectedChannel<BigtableStub> selection =
pool->GetChannelRandomTwoLeastUsed();
if (operation_context != nullptr) {
Expand All @@ -218,8 +206,8 @@ AsyncStreamingHelper(

} // namespace

std::unique_ptr<google::cloud::internal::StreamingReadRpc<
google::bigtable::v2::ReadRowsResponse>>
std::unique_ptr<
internal::StreamingReadRpc<google::bigtable::v2::ReadRowsResponse>>
BigtableRandomTwoLeastUsed::ReadRows(
std::shared_ptr<grpc::ClientContext> context, Options const& options,
google::bigtable::v2::ReadRowsRequest const& request,
Expand All @@ -233,8 +221,8 @@ BigtableRandomTwoLeastUsed::ReadRows(
});
}

std::unique_ptr<google::cloud::internal::StreamingReadRpc<
google::bigtable::v2::SampleRowKeysResponse>>
std::unique_ptr<
internal::StreamingReadRpc<google::bigtable::v2::SampleRowKeysResponse>>
BigtableRandomTwoLeastUsed::SampleRowKeys(
std::shared_ptr<grpc::ClientContext> context, Options const& options,
google::bigtable::v2::SampleRowKeysRequest const& request,
Expand All @@ -259,8 +247,8 @@ BigtableRandomTwoLeastUsed::MutateRow(
});
}

std::unique_ptr<google::cloud::internal::StreamingReadRpc<
google::bigtable::v2::MutateRowsResponse>>
std::unique_ptr<
internal::StreamingReadRpc<google::bigtable::v2::MutateRowsResponse>>
BigtableRandomTwoLeastUsed::MutateRows(
std::shared_ptr<grpc::ClientContext> context, Options const& options,
google::bigtable::v2::MutateRowsRequest const& request,
Expand Down Expand Up @@ -321,8 +309,8 @@ BigtableRandomTwoLeastUsed::PrepareQuery(
});
}

std::unique_ptr<google::cloud::internal::StreamingReadRpc<
google::bigtable::v2::ExecuteQueryResponse>>
std::unique_ptr<
internal::StreamingReadRpc<google::bigtable::v2::ExecuteQueryResponse>>
BigtableRandomTwoLeastUsed::ExecuteQuery(
std::shared_ptr<grpc::ClientContext> context, Options const& options,
google::bigtable::v2::ExecuteQueryRequest const& request,
Expand All @@ -336,12 +324,11 @@ BigtableRandomTwoLeastUsed::ExecuteQuery(
});
}

std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
google::bigtable::v2::ReadRowsResponse>>
std::unique_ptr<
internal::AsyncStreamingReadRpc<google::bigtable::v2::ReadRowsResponse>>
BigtableRandomTwoLeastUsed::AsyncReadRows(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::ReadRowsRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::ReadRowsResponse>(
Expand All @@ -353,12 +340,11 @@ BigtableRandomTwoLeastUsed::AsyncReadRows(
});
}

std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
std::unique_ptr<internal::AsyncStreamingReadRpc<
google::bigtable::v2::SampleRowKeysResponse>>
BigtableRandomTwoLeastUsed::AsyncSampleRowKeys(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::SampleRowKeysRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::SampleRowKeysResponse>(
Expand All @@ -373,9 +359,8 @@ BigtableRandomTwoLeastUsed::AsyncSampleRowKeys(

future<StatusOr<google::bigtable::v2::MutateRowResponse>>
BigtableRandomTwoLeastUsed::AsyncMutateRow(
google::cloud::CompletionQueue& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::MutateRowRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncHelper<future<StatusOr<google::bigtable::v2::MutateRowResponse>>>(
Expand All @@ -387,12 +372,11 @@ BigtableRandomTwoLeastUsed::AsyncMutateRow(
});
}

std::unique_ptr<google::cloud::internal::AsyncStreamingReadRpc<
google::bigtable::v2::MutateRowsResponse>>
std::unique_ptr<
internal::AsyncStreamingReadRpc<google::bigtable::v2::MutateRowsResponse>>
BigtableRandomTwoLeastUsed::AsyncMutateRows(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::MutateRowsRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::MutateRowsResponse>(
Expand All @@ -406,9 +390,8 @@ BigtableRandomTwoLeastUsed::AsyncMutateRows(

future<StatusOr<google::bigtable::v2::CheckAndMutateRowResponse>>
BigtableRandomTwoLeastUsed::AsyncCheckAndMutateRow(
google::cloud::CompletionQueue& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::CheckAndMutateRowRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncHelper<
Expand All @@ -424,9 +407,8 @@ BigtableRandomTwoLeastUsed::AsyncCheckAndMutateRow(

future<StatusOr<google::bigtable::v2::PingAndWarmResponse>>
BigtableRandomTwoLeastUsed::AsyncPingAndWarm(
google::cloud::CompletionQueue& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::PingAndWarmRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncHelper<
Expand All @@ -441,9 +423,8 @@ BigtableRandomTwoLeastUsed::AsyncPingAndWarm(

future<StatusOr<google::bigtable::v2::ReadModifyWriteRowResponse>>
BigtableRandomTwoLeastUsed::AsyncReadModifyWriteRow(
google::cloud::CompletionQueue& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::ReadModifyWriteRowRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncHelper<
Expand All @@ -459,9 +440,8 @@ BigtableRandomTwoLeastUsed::AsyncReadModifyWriteRow(

future<StatusOr<google::bigtable::v2::PrepareQueryResponse>>
BigtableRandomTwoLeastUsed::AsyncPrepareQuery(
google::cloud::CompletionQueue& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
google::bigtable::v2::PrepareQueryRequest const& request,
std::shared_ptr<OperationContext> operation_context) {
return AsyncHelper<
Expand All @@ -487,13 +467,12 @@ BigtableRandomTwoLeastUsed::GetClientConfiguration(
});
}

std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
std::unique_ptr<
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
BigtableRandomTwoLeastUsed::AsyncOpenTable(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>(
Expand All @@ -505,13 +484,12 @@ BigtableRandomTwoLeastUsed::AsyncOpenTable(
});
}

std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
std::unique_ptr<
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
BigtableRandomTwoLeastUsed::AsyncOpenAuthorizedView(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>(
Expand All @@ -524,13 +502,12 @@ BigtableRandomTwoLeastUsed::AsyncOpenAuthorizedView(
});
}

std::unique_ptr<::google::cloud::AsyncStreamingReadWriteRpc<
google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
std::unique_ptr<
AsyncStreamingReadWriteRpc<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>>
BigtableRandomTwoLeastUsed::AsyncOpenMaterializedView(
google::cloud::CompletionQueue const& cq,
std::shared_ptr<grpc::ClientContext> context,
google::cloud::internal::ImmutableOptions options,
CompletionQueue const& cq, std::shared_ptr<grpc::ClientContext> context,
internal::ImmutableOptions options,
std::shared_ptr<OperationContext> operation_context) {
return AsyncStreamingHelper<google::bigtable::v2::SessionRequest,
google::bigtable::v2::SessionResponse>(
Expand Down
Loading
Loading