Google Cloud Spanner C++ Client 2.13.0
A C++ Client Library for Google Cloud Spanner
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
google::cloud::spanner::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:

Constructor & Destructor Documentation

◆ Transaction() [1/5]

google::cloud::spanner::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.

◆ Transaction() [2/5]

google::cloud::spanner::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.

◆ Transaction() [3/5]

google::cloud::spanner::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.

◆ ~Transaction()

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

◆ Transaction() [4/5]

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

◆ Transaction() [5/5]

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

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Friends And Related Function Documentation

◆ operator!=

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

◆ operator==

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