diff --git a/google/cloud/storage/benchmarks/aggregate_download_throughput_options.cc b/google/cloud/storage/benchmarks/aggregate_download_throughput_options.cc index 300370b5321b5..740611901edb8 100644 --- a/google/cloud/storage/benchmarks/aggregate_download_throughput_options.cc +++ b/google/cloud/storage/benchmarks/aggregate_download_throughput_options.cc @@ -144,7 +144,7 @@ ParseAggregateDownloadThroughputOptions(std::vector const& argv, " is aborted if the average transfer rate is below this limit for" " the period set via `storage::DownloadStallTimeoutOption`.", [&options](std::string const& val) { - options.client_options.set( + options.client_options.set( static_cast(ParseBufferSize(val))); }}, {"--grpc-background-threads", diff --git a/google/cloud/storage/benchmarks/aggregate_download_throughput_options_test.cc b/google/cloud/storage/benchmarks/aggregate_download_throughput_options_test.cc index 03b54e085dfd1..e008ca3ab9a9d 100644 --- a/google/cloud/storage/benchmarks/aggregate_download_throughput_options_test.cc +++ b/google/cloud/storage/benchmarks/aggregate_download_throughput_options_test.cc @@ -70,9 +70,8 @@ TEST(AggregateDownloadThroughputOptions, Basic) { options->client_options.get()); EXPECT_EQ(std::chrono::seconds(10), options->client_options.get()); - EXPECT_EQ( - 100 * kKiB, - options->client_options.get()); + EXPECT_EQ(100 * kKiB, + options->client_options.get()); EXPECT_EQ(4, options->client_options.get()); EXPECT_EQ(123, options->client_options.get()); diff --git a/google/cloud/storage/benchmarks/aggregate_upload_throughput_options.cc b/google/cloud/storage/benchmarks/aggregate_upload_throughput_options.cc index 17bc9875ac3e5..bd7379f5229a4 100644 --- a/google/cloud/storage/benchmarks/aggregate_upload_throughput_options.cc +++ b/google/cloud/storage/benchmarks/aggregate_upload_throughput_options.cc @@ -157,7 +157,7 @@ ParseAggregateUploadThroughputOptions(std::vector const& argv, " is aborted if the average transfer rate is below this limit for" " the period set via `storage::TransferStallTimeoutOption`.", [&options](std::string const& val) { - options.client_options.set( + options.client_options.set( static_cast(ParseBufferSize(val))); }}, {"--grpc-background-threads", diff --git a/google/cloud/storage/benchmarks/aggregate_upload_throughput_options_test.cc b/google/cloud/storage/benchmarks/aggregate_upload_throughput_options_test.cc index 7e6b12e2e7dea..2e49569f4db7a 100644 --- a/google/cloud/storage/benchmarks/aggregate_upload_throughput_options_test.cc +++ b/google/cloud/storage/benchmarks/aggregate_upload_throughput_options_test.cc @@ -72,9 +72,8 @@ TEST(AggregateUploadThroughputOptions, Basic) { options->client_options.get()); EXPECT_EQ(std::chrono::seconds(10), options->client_options.get()); - EXPECT_EQ( - 100 * kKiB, - options->client_options.get()); + EXPECT_EQ(100 * kKiB, + options->client_options.get()); EXPECT_EQ(4, options->client_options.get()); EXPECT_EQ(123, options->client_options.get()); diff --git a/google/cloud/storage/benchmarks/benchmark_utils.cc b/google/cloud/storage/benchmarks/benchmark_utils.cc index be502f33713fd..eb4973c4e36ed 100644 --- a/google/cloud/storage/benchmarks/benchmark_utils.cc +++ b/google/cloud/storage/benchmarks/benchmark_utils.cc @@ -34,7 +34,6 @@ namespace cloud { namespace storage_benchmarks { namespace gcs = ::google::cloud::storage; -namespace gcs_ex = ::google::cloud::storage_experimental; void DeleteAllObjects(google::cloud::storage::Client client, std::string const& bucket_name, int thread_count) { @@ -197,20 +196,20 @@ void PrintOptions(std::ostream& os, std::string const& prefix, << absl::FormatDuration( absl::FromChrono(options.get())); } - if (options.has()) { + if (options.has()) { os << "\n# " << prefix << " Transfer Stall Minimum Rate: " << testing_util::FormatSize( - options.get()); + options.get()); } if (options.has()) { os << "\n# " << prefix << " Download Stall Timeout: " << absl::FormatDuration( absl::FromChrono(options.get())); } - if (options.has()) { + if (options.has()) { os << "\n# " << prefix << " Download Stall Minimum Rate: " << testing_util::FormatSize( - options.get()); + options.get()); } if (options.has()) { diff --git a/google/cloud/storage/benchmarks/throughput_options.cc b/google/cloud/storage/benchmarks/throughput_options.cc index 8cd3a88efa0ee..11d3452af4547 100644 --- a/google/cloud/storage/benchmarks/throughput_options.cc +++ b/google/cloud/storage/benchmarks/throughput_options.cc @@ -25,7 +25,6 @@ namespace storage_benchmarks { namespace { namespace gcs = ::google::cloud::storage; -namespace gcs_ex = ::google::cloud::storage_experimental; Status ValidateQuantizedRange(std::string const& name, absl::optional minimum, @@ -368,7 +367,7 @@ google::cloud::StatusOr ParseThroughputOptions( " is aborted if the average transfer rate is below this limit for" " the period set via `storage::TransferStallTimeoutOption`.", [&options](std::string const& val) { - options.client_options.set( + options.client_options.set( static_cast(ParseBufferSize(val))); }}, {"--download-stall-timeout", @@ -385,7 +384,7 @@ google::cloud::StatusOr ParseThroughputOptions( " is aborted if the average transfer rate is below this limit for" " the period set via `storage::DownloadStallTimeoutOption`.", [&options](std::string const& val) { - options.client_options.set( + options.client_options.set( static_cast(ParseBufferSize(val))); }}, {"--minimum-sample-delay", diff --git a/google/cloud/storage/benchmarks/throughput_options_test.cc b/google/cloud/storage/benchmarks/throughput_options_test.cc index 125f99a051214..78c4256b184c0 100644 --- a/google/cloud/storage/benchmarks/throughput_options_test.cc +++ b/google/cloud/storage/benchmarks/throughput_options_test.cc @@ -26,7 +26,6 @@ namespace storage_benchmarks { namespace { namespace gcs = ::google::cloud::storage; -namespace gcs_ex = ::google::cloud::storage_experimental; using ::testing::ElementsAre; using ::testing::UnorderedElementsAre; @@ -112,14 +111,12 @@ TEST(ThroughputOptions, Basic) { options->direct_path_options.get()); EXPECT_EQ(std::chrono::seconds(86400), options->client_options.get()); - EXPECT_EQ( - 7 * kKiB, - options->client_options.get()); + EXPECT_EQ(7 * kKiB, + options->client_options.get()); EXPECT_EQ(std::chrono::seconds(86401), options->client_options.get()); - EXPECT_EQ( - 9 * kKiB, - options->client_options.get()); + EXPECT_EQ(9 * kKiB, + options->client_options.get()); EXPECT_EQ("vN", options->rest_options.get()); EXPECT_EQ(16, diff --git a/google/cloud/storage/client_options.cc b/google/cloud/storage/client_options.cc index fdc98ff0d7c42..c2b89b9a5bc86 100644 --- a/google/cloud/storage/client_options.cc +++ b/google/cloud/storage/client_options.cc @@ -187,8 +187,8 @@ Options DefaultOptions(std::shared_ptr credentials, .set(0) .set(std::chrono::seconds( GOOGLE_CLOUD_CPP_STORAGE_DEFAULT_DOWNLOAD_STALL_TIMEOUT)) - .set(1) - .set(1) + .set(1) + .set(1) .set( LimitedTimeRetryPolicy( STORAGE_CLIENT_DEFAULT_MAXIMUM_RETRY_PERIOD) @@ -246,11 +246,11 @@ Options DefaultOptions(std::shared_ptr credentials, .set( o.get()) .set( - o.get()) + o.get()) .set( o.get()) .set( - o.get()) + o.get()) .set( o.get()) .set( diff --git a/google/cloud/storage/client_options_test.cc b/google/cloud/storage/client_options_test.cc index 227061c0674fe..b323608f0bc26 100644 --- a/google/cloud/storage/client_options_test.cc +++ b/google/cloud/storage/client_options_test.cc @@ -325,8 +325,7 @@ TEST_F(ClientOptionsTest, MakeOptionsFromDefault) { EXPECT_EQ("test-project-id", opts.get()); EXPECT_LT(0, opts.get()); EXPECT_LT(0, opts.get()); - EXPECT_LT(0, - opts.get()); + EXPECT_LT(0, opts.get()); EXPECT_LT(0, opts.get()); EXPECT_LT(0, opts.get()); EXPECT_TRUE(opts.has()); @@ -334,8 +333,7 @@ TEST_F(ClientOptionsTest, MakeOptionsFromDefault) { EXPECT_EQ(0, opts.get()); EXPECT_EQ(0, opts.get()); EXPECT_LT(0, opts.get().count()); - EXPECT_LT(0, - opts.get()); + EXPECT_LT(0, opts.get()); EXPECT_THAT(opts.get(), IsEmpty()); } @@ -364,19 +362,19 @@ TEST_F(ClientOptionsTest, DefaultOptions) { EXPECT_EQ(0, o.get()); EXPECT_EQ(0, o.get()); EXPECT_LT(std::chrono::seconds(0), o.get()); - EXPECT_LT(0, o.get()); + EXPECT_LT(0, o.get()); EXPECT_LT(std::chrono::seconds(0), o.get()); - EXPECT_LT(0, o.get()); + EXPECT_LT(0, o.get()); namespace rest = ::google::cloud::rest_internal; EXPECT_EQ(o.get(), o.get()); EXPECT_EQ(o.get(), - o.get()); + o.get()); EXPECT_EQ(o.get(), o.get()); EXPECT_EQ(o.get(), - o.get()); + o.get()); EXPECT_EQ(o.get(), o.get()); EXPECT_EQ(o.get(), diff --git a/google/cloud/storage/internal/curl_request_builder.cc b/google/cloud/storage/internal/curl_request_builder.cc index c23d47612d423..b524234302de6 100644 --- a/google/cloud/storage/internal/curl_request_builder.cc +++ b/google/cloud/storage/internal/curl_request_builder.cc @@ -97,11 +97,9 @@ CurlRequestBuilder& CurlRequestBuilder::ApplyClientOptions( http_version_ = std::move(options.get()); transfer_stall_timeout_ = options.get(); - transfer_stall_minimum_rate_ = - options.get(); + transfer_stall_minimum_rate_ = options.get(); download_stall_timeout_ = options.get(); - download_stall_minimum_rate_ = - options.get(); + download_stall_minimum_rate_ = options.get(); return *this; } diff --git a/google/cloud/storage/internal/grpc_client.cc b/google/cloud/storage/internal/grpc_client.cc index b294bbbda4327..b042bb7f0a472 100644 --- a/google/cloud/storage/internal/grpc_client.cc +++ b/google/cloud/storage/internal/grpc_client.cc @@ -373,7 +373,7 @@ StatusOr GrpcClient::InsertObjectMedia( auto const& current = google::cloud::internal::CurrentOptions(); auto timeout = ScaleStallTimeout( current.get(), - current.get(), + current.get(), google::storage::v2::ServiceConstants::MAX_WRITE_CHUNK_BYTES); auto create_watchdog = [cq = background_->cq(), timeout]() mutable { if (timeout == std::chrono::seconds(0)) { @@ -637,7 +637,7 @@ StatusOr GrpcClient::UploadChunk( auto const& current = google::cloud::internal::CurrentOptions(); auto const timeout = ScaleStallTimeout( current.get(), - current.get(), + current.get(), google::storage::v2::ServiceConstants::MAX_WRITE_CHUNK_BYTES); auto create_watchdog = [cq = background_->cq(), timeout]() mutable { diff --git a/google/cloud/storage/options.h b/google/cloud/storage/options.h index e80e1d4672ff0..5278f07ada6af 100644 --- a/google/cloud/storage/options.h +++ b/google/cloud/storage/options.h @@ -50,26 +50,6 @@ struct HttpVersionOption { using Type = std::string; }; -/** - * The minimum accepted bytes/second transfer rate. - * - * If the average rate is below this value for the `TransferStallTimeoutOption` - * then the transfer is aborted. - */ -struct TransferStallMinimumRateOption { - using Type = std::int32_t; -}; - -/** - * The minimum accepted bytes/second download rate. - * - * If the average rate is below this value for the `DownloadStallTimeoutOption` - * then the download is aborted. - */ -struct DownloadStallMinimumRateOption { - using Type = std::int32_t; -}; - GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END } // namespace storage_experimental @@ -253,6 +233,16 @@ struct TransferStallTimeoutOption { using Type = std::chrono::seconds; }; +/** + * The minimum accepted bytes/second transfer rate. + * + * If the average rate is below this value for the `TransferStallTimeoutOption` + * then the transfer is aborted. + */ +struct TransferStallMinimumRateOption { + using Type = std::int32_t; +}; + /** * Sets the download stall timeout. * @@ -271,6 +261,16 @@ struct DownloadStallTimeoutOption { using Type = std::chrono::seconds; }; +/** + * The minimum accepted bytes/second download rate. + * + * If the average rate is below this value for the `DownloadStallTimeoutOption` + * then the download is aborted. + */ +struct DownloadStallMinimumRateOption { + using Type = std::int32_t; +}; + /// Set the retry policy for a GCS client. struct RetryPolicyOption { using Type = std::shared_ptr;