Google Cloud Spanner C++ Client  1.32.0
A C++ Client Library for Google Cloud Spanner
Classes | Public Member Functions | List of all members
google::cloud::spanner::v1::Transaction Class Reference

The representation of a Cloud Spanner transaction. More...

#include <google/cloud/spanner/transaction.h>

Classes

class  ReadOnlyOptions
 Options for ReadOnly transactions. More...
 
class  ReadWriteOptions
 Options for ReadWrite transactions. More...
 
class  SingleUseOptions
 Options for "single-use", ReadOnly transactions, where Spanner chooses the read timestamp, subject to user-provided bounds. More...
 

Public Member Functions

 ~Transaction ()
 
Construction of read-only and read-write transactions.
 Transaction (ReadOnlyOptions opts)
 
 Transaction (ReadWriteOptions opts)
 
 Transaction (Transaction const &txn, ReadWriteOptions opts)
 
Regular value type, supporting copy, assign, move.
 Transaction (Transaction &&)=default
 
Transactionoperator= (Transaction &&)=default
 
 Transaction (Transaction const &)=default
 
Transactionoperator= (Transaction const &)=default
 

Friends

Equality operators
bool operator== (Transaction const &a, Transaction const &b)
 
bool operator!= (Transaction const &a, Transaction const &b)
 

Detailed Description

The representation of a Cloud Spanner transaction.

A transaction is a set of reads and writes that execute atomically at a single logical point in time across the columns/rows/tables in a database. Those reads and writes are grouped by passing them the same Transaction.

All reads/writes in the transaction must be executed within the same session, and that session may have only one transaction active at a time.

Spanner supports these transaction modes:

Definition at line 58 of file transaction.h.

Constructor & Destructor Documentation

◆ Transaction() [1/5]

google::cloud::spanner::v1::Transaction::Transaction ( ReadOnlyOptions  opts)
explicit
Note
This is a lazy evaluated operation. No RPCs are made as part of creating a Transaction object. Instead, the first request to the server (for example as part of a ExecuteQuery() call) will also create the transaction.

Definition at line 94 of file transaction.cc.

◆ Transaction() [2/5]

google::cloud::spanner::v1::Transaction::Transaction ( ReadWriteOptions  opts)
explicit

Note
This is a lazy evaluated operation. No RPCs are made as part of creating a Transaction object. Instead, the first request to the server (for example as part of a ExecuteQuery() call) will also create the transaction.

Definition at line 101 of file transaction.cc.

◆ Transaction() [3/5]

google::cloud::spanner::v1::Transaction::Transaction ( Transaction const &  txn,
ReadWriteOptions  opts 
)

Note
This is a lazy evaluated operation. No RPCs are made as part of creating a Transaction object. Instead, the first request to the server (for example as part of a ExecuteQuery() call) will also create the transaction.

Definition at line 108 of file transaction.cc.

◆ ~Transaction()

google::cloud::spanner::v1::Transaction::~Transaction ( )
default

◆ Transaction() [4/5]

google::cloud::spanner::v1::Transaction::Transaction ( Transaction &&  )
default

◆ Transaction() [5/5]

google::cloud::spanner::v1::Transaction::Transaction ( Transaction const &  )
default

Member Function Documentation

◆ operator=() [1/2]

Transaction& google::cloud::spanner::v1::Transaction::operator= ( Transaction &&  )
default

◆ operator=() [2/2]

Transaction& google::cloud::spanner::v1::Transaction::operator= ( Transaction const &  )
default

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( Transaction const &  a,
Transaction const &  b 
)
friend

Definition at line 157 of file transaction.h.

◆ operator==

bool operator== ( Transaction const &  a,
Transaction const &  b 
)
friend

Definition at line 154 of file transaction.h.