Skip to content

Commit cd223d9

Browse files
committed
use generic+background_thread
1 parent 091ed4e commit cd223d9

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

google/cloud/storage/internal/tracing_connection.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "google/cloud/storage/options.h"
1818
#include "google/cloud/storage/parallel_upload.h"
1919
#include "google/cloud/internal/opentelemetry.h"
20-
#include "google/cloud/internal/rest_pure_background_threads_impl.h"
2120
#include "google/cloud/options.h"
2221
#if GOOGLE_CLOUD_CPP_STORAGE_HAVE_GRPC
2322
#include "google/cloud/grpc_options.h"
@@ -49,8 +48,7 @@ std::size_t DefaultThreadPoolSize(Options const& options) {
4948
TracingConnection::TracingConnection(std::shared_ptr<StorageConnection> impl)
5049
: impl_(std::move(impl)),
5150
background_threads_(
52-
std::make_unique<
53-
rest_internal::AutomaticallyCreatedRestPureBackgroundThreads>(
51+
std::make_unique<AutomaticallyCreatedStorageBackgroundThreads>(
5452
DefaultThreadPoolSize(impl_->options()))) {}
5553

5654
TracingConnection::~TracingConnection() = default;

google/cloud/storage/internal/tracing_connection.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@
1919
#include "google/cloud/storage/internal/storage_connection.h"
2020
#include "google/cloud/storage/parallel_upload.h"
2121
#include "google/cloud/storage/version.h"
22+
#include "google/cloud/internal/generic_background_threads_impl.h"
23+
#if GOOGLE_CLOUD_CPP_STORAGE_HAVE_GRPC
24+
#include "google/cloud/background_threads.h"
25+
#include "google/cloud/completion_queue.h"
26+
#else
2227
#include "google/cloud/internal/rest_pure_background_threads_impl.h"
28+
#endif
2329
#include <memory>
2430
#include <string>
2531

@@ -204,9 +210,23 @@ class TracingConnection : public storage::internal::StorageConnection {
204210

205211
static BucketMetadataCache& cache();
206212

213+
#if GOOGLE_CLOUD_CPP_STORAGE_HAVE_GRPC
214+
using StorageBackgroundThreads = google::cloud::BackgroundThreads;
215+
using AutomaticallyCreatedStorageBackgroundThreads =
216+
google::cloud::internal::AutomaticallyCreatedBackgroundThreadsImpl<
217+
google::cloud::CompletionQueue, google::cloud::BackgroundThreads>;
218+
#else
219+
using StorageBackgroundThreads =
220+
google::cloud::rest_internal::RestPureBackgroundThreads;
221+
using AutomaticallyCreatedStorageBackgroundThreads =
222+
google::cloud::internal::AutomaticallyCreatedBackgroundThreadsImpl<
223+
rest_internal::RestPureCompletionQueue,
224+
rest_internal::RestPureBackgroundThreads,
225+
rest_internal::RestPureQueueTraits>;
226+
#endif
227+
207228
std::shared_ptr<StorageConnection> impl_;
208-
std::unique_ptr<google::cloud::rest_internal::RestPureBackgroundThreads>
209-
background_threads_;
229+
std::unique_ptr<StorageBackgroundThreads> background_threads_;
210230
};
211231

212232
std::shared_ptr<storage::internal::StorageConnection> MakeTracingClient(

0 commit comments

Comments
 (0)