Skip to content

Commit f5afe10

Browse files
committed
chore: format files
1 parent 428ca5e commit f5afe10

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

google/cloud/spanner/integration_tests/client_integration_test.cc

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "google/cloud/spanner/testing/database_integration_test.h"
2121
#include "google/cloud/credentials.h"
2222
#include "google/cloud/internal/random.h"
23-
#include "google/cloud/log.h"
2423
#include "google/cloud/testing_util/status_matchers.h"
2524
#include <gmock/gmock.h>
2625
#include <map>
@@ -780,8 +779,9 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
780779
}
781780
auto const singer_id = 101;
782781

783-
auto mutation_helper = [singer_id] (std::string new_name) {
784-
return Mutations{MakeInsertOrUpdateMutation("Singers", {"SingerId", "FirstName"}, singer_id, new_name)};
782+
auto mutation_helper = [singer_id](std::string new_name) {
783+
return Mutations{MakeInsertOrUpdateMutation(
784+
"Singers", {"SingerId", "FirstName"}, singer_id, new_name)};
785785
};
786786

787787
// initial insert
@@ -790,15 +790,20 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
790790

791791
// transaction A will do a DML after another transaction has executed DML
792792
// If optimistic, we expect transaction A to be aborted
793-
auto test_helper = [&mutation_helper, singer_id] (Transaction::ReadLockMode read_lock_mode) -> StatusOr<CommitResult> {
793+
auto test_helper =
794+
[&mutation_helper, singer_id](
795+
Transaction::ReadLockMode read_lock_mode) -> StatusOr<CommitResult> {
794796
// here we create tx A and confirm it can perform a read.
795-
auto tx_a = MakeReadWriteTransaction(Transaction::ReadWriteOptions(read_lock_mode));
796-
auto tx_a_read_result = client_->Read(tx_a, "Singers", KeySet().AddKey(MakeKey(singer_id)), {"SingerId"});
797+
auto tx_a =
798+
MakeReadWriteTransaction(Transaction::ReadWriteOptions(read_lock_mode));
799+
auto tx_a_read_result = client_->Read(
800+
tx_a, "Singers", KeySet().AddKey(MakeKey(singer_id)), {"SingerId"});
797801
for (auto row : StreamOf<std::tuple<std::int64_t>>(tx_a_read_result)) {
798802
EXPECT_STATUS_OK(row);
799803
}
800804

801-
// now a separate tx b will perform a write operation before tx A is finished.
805+
// now a separate tx b will perform a write operation before tx A is
806+
// finished.
802807
auto tx_b = client_->Commit(mutation_helper("FirstModifiedName"));
803808
EXPECT_STATUS_OK(tx_b);
804809

@@ -808,7 +813,8 @@ TEST_F(ClientIntegrationTest, ReadLockModeOptionIsSent) {
808813
};
809814

810815
auto optimistic_result = test_helper(Transaction::ReadLockMode::kOptimistic);
811-
auto pessimistic_result = test_helper(Transaction::ReadLockMode::kPessimistic);
816+
auto pessimistic_result =
817+
test_helper(Transaction::ReadLockMode::kPessimistic);
812818

813819
EXPECT_STATUS_OK(pessimistic_result);
814820
EXPECT_THAT(optimistic_result, StatusIs(StatusCode::kAborted));

google/cloud/spanner/transaction.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ google::protobuf::Duration ToProto(std::chrono::nanoseconds ns) {
3434
return proto;
3535
}
3636

37-
google::spanner::v1::TransactionOptions_ReadWrite_ReadLockMode ToProto(Transaction::ReadLockMode read_lock_mode) {
38-
return static_cast<google::spanner::v1::TransactionOptions_ReadWrite_ReadLockMode>(read_lock_mode);
37+
google::spanner::v1::TransactionOptions_ReadWrite_ReadLockMode ToProto(
38+
Transaction::ReadLockMode read_lock_mode) {
39+
return static_cast<
40+
google::spanner::v1::TransactionOptions_ReadWrite_ReadLockMode>(
41+
read_lock_mode);
3942
}
4043

4144
google::spanner::v1::TransactionOptions MakeOpts(
@@ -77,8 +80,7 @@ Transaction::ReadOnlyOptions::ReadOnlyOptions(
7780

7881
Transaction::ReadWriteOptions::ReadWriteOptions() = default;
7982

80-
Transaction::ReadWriteOptions::ReadWriteOptions(
81-
ReadLockMode read_lock_mode) {
83+
Transaction::ReadWriteOptions::ReadWriteOptions(ReadLockMode read_lock_mode) {
8284
rw_opts_.set_read_lock_mode(ToProto(read_lock_mode));
8385
}
8486

@@ -88,7 +90,6 @@ Transaction::ReadWriteOptions& Transaction::ReadWriteOptions::WithTag(
8890
return *this;
8991
}
9092

91-
9293
Transaction::SingleUseOptions::SingleUseOptions(ReadOnlyOptions opts) {
9394
ro_opts_ = std::move(opts.ro_opts_);
9495
}

0 commit comments

Comments
 (0)