15 #ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_TRANSACTION_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_SPANNER_TRANSACTION_H
18 #include "google/cloud/spanner/internal/transaction_impl.h"
19 #include "google/cloud/spanner/timestamp.h"
20 #include "google/cloud/spanner/version.h"
21 #include "absl/types/optional.h"
22 #include <google/spanner/v1/transaction.pb.h>
29 namespace spanner_internal {
31 struct TransactionInternals;
78 google::spanner::v1::TransactionOptions_ReadOnly ro_opts_;
94 google::spanner::v1::TransactionOptions_ReadWrite rw_opts_;
95 absl::optional<std::string> tag_;
124 google::spanner::v1::TransactionOptions_ReadOnly ro_opts_;
155 return a.impl_ == b.impl_;
169 Transaction(std::string session_id, std::string transaction_id,
170 std::string transaction_tag);
172 std::shared_ptr<spanner_internal::TransactionImpl> impl_;
209 namespace spanner_internal {
212 struct TransactionInternals {
213 template <
typename T>
220 template <
typename Functor>
227 return txn.impl_->Visit(std::forward<Functor>(f));
231 std::string session_id, std::string transaction_id,
232 std::string transaction_tag);
235 template <
typename T>
237 return TransactionInternals::MakeSingleUseTransaction(std::forward<T>(opts));
240 template <
typename Functor>
246 return TransactionInternals::Visit(std::move(txn), std::forward<Functor>(f));
250 std::string session_id, std::string transaction_id,
251 std::string transaction_tag) {
252 return TransactionInternals::MakeTransactionFromIds(
253 std::move(session_id), std::move(transaction_id),
254 std::move(transaction_tag));