1515#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_CLIENT_H_
1616#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_CLIENT_H_
1717
18- #include " google/cloud/storage/internal/raw_client .h"
18+ #include " google/cloud/storage/internal/logging_client .h"
1919#include " google/cloud/storage/internal/retry_client.h"
2020#include " google/cloud/storage/list_buckets_reader.h"
2121#include " google/cloud/storage/list_objects_reader.h"
@@ -28,7 +28,7 @@ inline namespace STORAGE_CLIENT_NS {
2828/* *
2929 * The Google Cloud Storage Client.
3030 *
31- * @warning this implementation is incomplete, we are still prototyping .
31+ * @warning this implementation is incomplete.
3232 */
3333class Client {
3434 public:
@@ -52,12 +52,12 @@ class Client {
5252 template <typename ... Policies>
5353 explicit Client (std::shared_ptr<internal::RawClient> client,
5454 Policies&&... policies)
55- : raw_client_(new internal::RetryClient(
56- std::move (client), std::forward<Policies>(policies)...)) {}
55+ : raw_client_(
56+ Decorate ( std::move(client), std::forward<Policies>(policies)...)) {}
5757
58- // / Build a client with an specific RawClient, without retry policies .
59- struct NoRetry {};
60- explicit Client (std::shared_ptr<internal::RawClient> client, NoRetry )
58+ // / Build a client with an specific RawClient, without decorations .
59+ struct NoDecorations {};
60+ explicit Client (std::shared_ptr<internal::RawClient> client, NoDecorations )
6161 : raw_client_(std::move(client)) {}
6262
6363 /* *
@@ -385,13 +385,26 @@ class Client {
385385 return raw_client_->UpdateObjectAcl (request).second ;
386386 }
387387
388+ std::shared_ptr<internal::RawClient> raw_client () const {
389+ return raw_client_;
390+ }
391+
388392 private:
389393 BucketMetadata GetBucketMetadataImpl (
390394 internal::GetBucketMetadataRequest const & request);
391395
392396 ObjectMetadata InsertObjectMediaImpl (
393397 internal::InsertObjectMediaRequest const & request);
394398
399+ template <typename ... Policies>
400+ std::shared_ptr<internal::RawClient> Decorate (
401+ std::shared_ptr<internal::RawClient> client, Policies&&... policies) {
402+ auto logging = std::make_shared<internal::LoggingClient>(std::move (client));
403+ auto retry = std::make_shared<internal::RetryClient>(
404+ std::move (logging), std::forward<Policies>(policies)...);
405+ return retry;
406+ }
407+
395408 private:
396409 std::shared_ptr<internal::RawClient> raw_client_;
397410};
0 commit comments