firebase::firestore::TransactionOptions

#include <transaction_options.h>

Options to customize transaction behavior forFirestore.runTransaction().

Summary

Constructors and Destructors

TransactionOptions()
Creates the defaultTransactionOptions.
TransactionOptions(constTransactionOptions & other)
Copy constructor.
TransactionOptions(TransactionOptions && other)
Move constructor.

Public functions

ToString() const
std::string
Returns a string representation of thisTransactionOptions object for logging/debugging purposes.
max_attempts() const
int32_t
Gets the maximum number of attempts to commit, after which the transaction fails.
operator=(constTransactionOptions & other)=default
Copy assignment operator.
operator=(TransactionOptions && other)=default
Move assignment operator.
set_max_attempts(int32_t max_attempts)
void
Sets the maximum number of attempts to commit, after which the transaction fails.

Friend classes

operator<<
friend std::ostream &
Outputs the string representation of thisTransactionOptions object to the given stream.

Public functions

ToString

std::stringToString()const

TransactionOptions

TransactionOptions(constTransactionOptions&other)=default

Copy constructor.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
TransactionOptions to copy from.

TransactionOptions

TransactionOptions(TransactionOptions&&other)=default

Move constructor.

Moving is not any more efficient than copying forTransactionOptions because this class is trivially copyable; however, future additions to this class may make it not trivially copyable, at which point moving would be more efficient than copying. After being moved from,TransactionOptions is in a valid but unspecified state.

Details
Parameters
other
TransactionOptions to move data from.

max_attempts

int32_tmax_attempts()const

Gets the maximum number of attempts to commit, after which the transaction fails.

The default value is 5.

operator=

TransactionOptions&operator=(constTransactionOptions&other)=default

Copy assignment operator.

This performs a deep copy, creating an independent instance.

Details
Parameters
other
TransactionOptions to copy from.
Returns
Reference to the destinationTransactionOptions.

operator=

TransactionOptions&operator=(TransactionOptions&&other)=default

Move assignment operator.

Moving is not any more efficient than copying forTransactionOptions because this class is trivially copyable; however, future additions to this class may make it not trivially copyable, at which point moving would be more efficient than copying. After being moved from,TransactionOptions is in a valid but unspecified state.

Details
Parameters
other
TransactionOptions to move data from.
Returns
Reference to the destinationTransactionOptions.

set_max_attempts

voidset_max_attempts(int32_tmax_attempts)

Sets the maximum number of attempts to commit, after which the transaction fails.

The default value is 5.

Details
Parameters
max_attempts
The maximum number of attempts; must be greater than zero.

Friend classes

operator<<

friendstd::ostream&operator<<(std::ostream&,constTransactionOptions&)

Outputs the string representation of thisTransactionOptions object to the given stream.

See also:ToString() for comments on the representation format.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-01-23 UTC.