@@ -111,21 +111,54 @@ class TransactionOptions(proto.Message):
111111 This field is a member of `oneof`_ ``mode``.
112112 """
113113
114+ class ConcurrencyMode (proto .Enum ):
115+ r"""The type of concurrency control mode for transactions.
116+
117+ Values:
118+ CONCURRENCY_MODE_UNSPECIFIED (0):
119+ Start the transaction with the database-level
120+ default concurrency mode.
121+ OPTIMISTIC (1):
122+ Use optimistic concurrency control for the
123+ new transaction.
124+ PESSIMISTIC (2):
125+ Use pessimistic concurrency control for the
126+ new transaction.
127+ """
128+
129+ CONCURRENCY_MODE_UNSPECIFIED = 0
130+ OPTIMISTIC = 1
131+ PESSIMISTIC = 2
132+
114133 class ReadWrite (proto .Message ):
115134 r"""Options for a transaction that can be used to read and write
116135 documents.
117- Firestore does not allow 3rd party auth requests to create
118- read-write. transactions.
119136
120137 Attributes:
121138 retry_transaction (bytes):
122139 An optional transaction to retry.
140+ concurrency_mode (google.cloud.firestore_v1.types.TransactionOptions.ConcurrencyMode):
141+ Optional. The concurrency control mode to use
142+ for this transaction.
143+ A database is able to use different concurrency
144+ modes for different transactions simultaneously.
145+
146+ 3rd party auth requests are only allowed to
147+ create optimistic read-write transactions and
148+ must specify that here even if the
149+ database-level setting is already configured to
150+ optimistic.
123151 """
124152
125153 retry_transaction : bytes = proto .Field (
126154 proto .BYTES ,
127155 number = 1 ,
128156 )
157+ concurrency_mode : "TransactionOptions.ConcurrencyMode" = proto .Field (
158+ proto .ENUM ,
159+ number = 2 ,
160+ enum = "TransactionOptions.ConcurrencyMode" ,
161+ )
129162
130163 class ReadOnly (proto .Message ):
131164 r"""Options for a transaction that can only be used to read
0 commit comments