Skip to content

Commit 92a3ed7

Browse files
committed
Format code properly
1 parent a3da4a0 commit 92a3ed7

15 files changed

Lines changed: 59 additions & 69 deletions

google/cloud/storage/benchmarks/throughput_experiment.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ class ResumableUpload : public ThroughputExperiment {
8888
auto const start = std::chrono::system_clock::now();
8989
auto timer = Timer::PerThread();
9090
auto writer = client_.WriteObject(
91-
bucket_name, object_name,
92-
google::cloud::Options{}.set<gcs::UploadChecksumValidationOption>(
93-
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
91+
bucket_name, object_name,
92+
google::cloud::Options{}.set<gcs::UploadChecksumValidationOption>(
93+
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
9494
auto upload_id = ExtractUploadId(writer.resumable_session_id());
9595
for (std::int64_t offset = 0; offset < config.object_size;
9696
offset += config.app_buffer_size) {
@@ -158,11 +158,10 @@ class SimpleUpload : public ThroughputExperiment {
158158
auto timer = Timer::PerThread();
159159
auto data = absl::string_view{*random_data_}.substr(
160160
0, static_cast<std::size_t>(config.object_size));
161-
auto object_metadata =
162-
client_.InsertObject(
163-
bucket_name, object_name, data,
164-
google::cloud::Options{}.set<gcs::UploadChecksumValidationOption>(
165-
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
161+
auto object_metadata = client_.InsertObject(
162+
bucket_name, object_name, data,
163+
google::cloud::Options{}.set<gcs::UploadChecksumValidationOption>(
164+
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
166165
auto const usage = timer.Sample();
167166
auto generation = object_metadata
168167
? std::to_string(object_metadata->generation())
@@ -217,11 +216,10 @@ class DownloadObject : public ThroughputExperiment {
217216
config.read_range.has_value()
218217
? gcs::ReadRange(offset, offset + config.read_range->second)
219218
: gcs::ReadRange();
220-
auto reader =
221-
client_.ReadObject(
222-
bucket_name, object_name, read_range,
223-
google::cloud::Options{}.set<gcs::DownloadChecksumValidationOption>(
224-
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
219+
auto reader = client_.ReadObject(
220+
bucket_name, object_name, read_range,
221+
google::cloud::Options{}.set<gcs::DownloadChecksumValidationOption>(
222+
GetChecksumAlgorithm(config.enable_crc32c, config.enable_md5)));
225223
std::int64_t transfer_size = 0;
226224
while (!reader.eof() && !reader.bad()) {
227225
reader.read(buffer.data(), buffer.size());

google/cloud/storage/client.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,9 +1176,9 @@ class Client {
11761176
* @param bucket_name the name of the bucket that contains the object.
11771177
* @param object_name the name of the object to be read.
11781178
* @param options a list of optional query parameters and/or request headers.
1179-
* Valid types for this operation include `DownloadChecksumValidationOption`,
1180-
* `EncryptionKey`, `Generation`, `IfGenerationMatch`,
1181-
* `IfGenerationNotMatch`, `IfMetagenerationMatch`,
1179+
* Valid types for this operation include
1180+
* `DownloadChecksumValidationOption`, `EncryptionKey`, `Generation`,
1181+
* `IfGenerationMatch`, `IfGenerationNotMatch`, `IfMetagenerationMatch`,
11821182
* `IfMetagenerationNotMatch`, `ReadFromOffset`, `ReadRange`, `ReadLast`,
11831183
* `UserProject`, and `AcceptEncoding`.
11841184
*

google/cloud/storage/internal/checksum_helpers_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ TEST(ChecksumHelpersTest, UploadChecksumSettingsOnlyNewOptions) {
6060
EXPECT_FALSE(settings.md5);
6161
EXPECT_TRUE(settings.crc32c);
6262

63-
settings = GetUploadChecksumSettings(
64-
Options{}.set<UploadChecksumValidationOption>(
63+
settings =
64+
GetUploadChecksumSettings(Options{}.set<UploadChecksumValidationOption>(
6565
ChecksumAlgorithm::kCrc32c));
6666
EXPECT_TRUE(settings.md5);
6767
EXPECT_FALSE(settings.crc32c);

google/cloud/storage/internal/grpc/stub.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ StatusOr<storage::ObjectMetadata> GrpcStub::InsertObjectMedia(
348348
ApplyRoutingHeaders(*ctx, request);
349349
auto stream = stub_->WriteObject(std::move(ctx), options);
350350

351-
auto const settings =
352-
storage::internal::GetUploadChecksumSettings(options);
351+
auto const settings = storage::internal::GetUploadChecksumSettings(options);
353352
auto hash_function = storage::internal::CreateHashFunction(
354353
request.GetOption<storage::Crc32cChecksumValue>(), settings.crc32c,
355354
request.GetOption<storage::MD5HashValue>(), settings.md5);

google/cloud/storage/internal/hash_function.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ std::unique_ptr<HashFunction> CreateHashFunction(
6464
ReadObjectRangeRequest const& request) {
6565
if (request.RequiresRangeHeader()) return CreateNullHashFunction();
6666

67-
auto const settings = GetDownloadChecksumSettings(
68-
google::cloud::internal::CurrentOptions());
67+
auto const settings =
68+
GetDownloadChecksumSettings(google::cloud::internal::CurrentOptions());
6969
auto const disable_md5 = settings.md5;
7070
auto const disable_crc32c = settings.crc32c;
7171
if (disable_md5 && disable_crc32c) {
@@ -85,8 +85,8 @@ std::unique_ptr<HashFunction> CreateHashFunction(
8585
return CreateNullHashFunction();
8686
}
8787

88-
auto const settings = GetUploadChecksumSettings(
89-
google::cloud::internal::CurrentOptions());
88+
auto const settings =
89+
GetUploadChecksumSettings(google::cloud::internal::CurrentOptions());
9090
return CreateHashFunction(request.GetOption<Crc32cChecksumValue>(),
9191
settings.crc32c, request.GetOption<MD5HashValue>(),
9292
settings.md5);

google/cloud/storage/internal/hash_function_impl_test.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,12 +437,10 @@ TEST(HashFunctionImplTest, CreateHashFunctionInsertObjectMedia) {
437437
auto const upload_cases = testing::UploadHashCases();
438438

439439
for (auto const& test : upload_cases) {
440-
bool disable_crc32c =
441-
(test.validation_algo == ChecksumAlgorithm::kNone ||
442-
test.validation_algo == ChecksumAlgorithm::kMD5);
443-
bool disable_md5 =
444-
(test.validation_algo == ChecksumAlgorithm::kNone ||
445-
test.validation_algo == ChecksumAlgorithm::kCrc32c);
440+
bool disable_crc32c = (test.validation_algo == ChecksumAlgorithm::kNone ||
441+
test.validation_algo == ChecksumAlgorithm::kMD5);
442+
bool disable_md5 = (test.validation_algo == ChecksumAlgorithm::kNone ||
443+
test.validation_algo == ChecksumAlgorithm::kCrc32c);
446444
auto function = CreateHashFunction(test.crc32_value, disable_crc32c,
447445
test.md5_value, disable_md5);
448446
ASSERT_STATUS_OK(function->Update(/*offset=*/0, kQuickFox));

google/cloud/storage/internal/hash_validator.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,17 @@ std::unique_ptr<HashValidator> CreateHashValidator(
5757
ReadObjectRangeRequest const& request) {
5858
if (request.RequiresRangeHeader()) return CreateNullHashValidator();
5959

60-
auto const settings = GetDownloadChecksumSettings(
61-
google::cloud::internal::CurrentOptions());
60+
auto const settings =
61+
GetDownloadChecksumSettings(google::cloud::internal::CurrentOptions());
6262
auto const disable_md5 = settings.md5;
6363
auto const disable_crc32c = settings.crc32c;
6464
return CreateHashValidator(disable_md5, disable_crc32c);
6565
}
6666

6767
std::unique_ptr<HashValidator> CreateHashValidator(
6868
ResumableUploadRequest const& /*request*/) {
69-
auto const settings = GetUploadChecksumSettings(
70-
google::cloud::internal::CurrentOptions());
69+
auto const settings =
70+
GetUploadChecksumSettings(google::cloud::internal::CurrentOptions());
7171
auto const disable_md5 = settings.md5;
7272
auto const disable_crc32c = settings.crc32c;
7373
return CreateHashValidator(disable_md5, disable_crc32c);

google/cloud/storage/internal/hash_validator_test.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,8 @@ TEST(HashValidatorImplTest, CreateHashFunctionUpload) {
226226
for (auto const& test : upload_cases) {
227227
google::cloud::internal::OptionsSpan span(
228228
Options{}.set<UploadChecksumValidationOption>(test.validation_algo));
229-
auto request =
230-
ResumableUploadRequest("test-bucket", "test-object")
231-
.set_multiple_options(test.crc32_value, test.md5_value);
229+
auto request = ResumableUploadRequest("test-bucket", "test-object")
230+
.set_multiple_options(test.crc32_value, test.md5_value);
232231
auto validator = CreateHashValidator(request);
233232
auto actual =
234233
std::move(*validator).Finish(HashQuick(CreateHashFunction(request)));

google/cloud/storage/internal/object_requests.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ std::ostream& operator<<(std::ostream& os, GetObjectMetadataRequest const& r);
105105
*/
106106
template <typename Derived>
107107
using InsertObjectRequestImpl = GenericObjectRequest<
108-
Derived, ContentEncoding, ContentType, Crc32cChecksumValue,
109-
EncryptionKey, IfGenerationMatch,
110-
IfGenerationNotMatch, IfMetagenerationMatch, IfMetagenerationNotMatch,
111-
KmsKeyName, MD5HashValue, PredefinedAcl, Projection, UserProject,
112-
UploadFromOffset, UploadLimit, WithObjectMetadata>;
108+
Derived, ContentEncoding, ContentType, Crc32cChecksumValue, EncryptionKey,
109+
IfGenerationMatch, IfGenerationNotMatch, IfMetagenerationMatch,
110+
IfMetagenerationNotMatch, KmsKeyName, MD5HashValue, PredefinedAcl,
111+
Projection, UserProject, UploadFromOffset, UploadLimit, WithObjectMetadata>;
113112

114113
/**
115114
* Represents a request to the `Objects: insert` API with a string for the
@@ -193,10 +192,9 @@ std::ostream& operator<<(std::ostream& os, CopyObjectRequest const& r);
193192
*/
194193
class ReadObjectRangeRequest
195194
: public GenericObjectRequest<
196-
ReadObjectRangeRequest,
197-
EncryptionKey, Generation, IfGenerationMatch, IfGenerationNotMatch,
198-
IfMetagenerationMatch, IfMetagenerationNotMatch, ReadFromOffset,
199-
ReadRange, ReadLast, UserProject, AcceptEncoding> {
195+
ReadObjectRangeRequest, EncryptionKey, Generation, IfGenerationMatch,
196+
IfGenerationNotMatch, IfMetagenerationMatch, IfMetagenerationNotMatch,
197+
ReadFromOffset, ReadRange, ReadLast, UserProject, AcceptEncoding> {
200198
public:
201199
using GenericObjectRequest::GenericObjectRequest;
202200

@@ -438,12 +436,12 @@ std::ostream& operator<<(std::ostream& os, RestoreObjectRequest const& r);
438436
class ResumableUploadRequest
439437
: public GenericObjectRequest<
440438
ResumableUploadRequest, ContentEncoding, ContentType,
441-
Crc32cChecksumValue,
442-
EncryptionKey, IfGenerationMatch, IfGenerationNotMatch,
443-
IfMetagenerationMatch, IfMetagenerationNotMatch, KmsKeyName,
444-
MD5HashValue, PredefinedAcl, Projection, UseResumableUploadSession,
445-
UserProject, UploadFromOffset, UploadLimit, WithObjectMetadata,
446-
UploadContentLength, AutoFinalize, UploadBufferSize> {
439+
Crc32cChecksumValue, EncryptionKey, IfGenerationMatch,
440+
IfGenerationNotMatch, IfMetagenerationMatch, IfMetagenerationNotMatch,
441+
KmsKeyName, MD5HashValue, PredefinedAcl, Projection,
442+
UseResumableUploadSession, UserProject, UploadFromOffset, UploadLimit,
443+
WithObjectMetadata, UploadContentLength, AutoFinalize,
444+
UploadBufferSize> {
447445
public:
448446
ResumableUploadRequest() = default;
449447

google/cloud/storage/internal/object_write_streambuf_test.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,7 @@ TEST(ObjectWriteStreambufTest, FlushFinalWithHashes) {
691691
ObjectWriteStreambuf streambuf(
692692
std::move(mock), request, "test-only-upload-id",
693693
/*committed_size=*/0, std::nullopt, /*max_buffer_size=*/quantum,
694-
CreateHashFunction(Crc32cChecksumValue(), false,
695-
MD5HashValue(), false),
694+
CreateHashFunction(Crc32cChecksumValue(), false, MD5HashValue(), false),
696695
HashValues{}, CreateHashValidator(request), AutoFinalizeConfig::kEnabled);
697696

698697
streambuf.sputn(payload.data(), payload.size());

0 commit comments

Comments
 (0)