Google Cloud Datastore supports transactions. A transaction is an operation or set of operations that is atomic—either all of the operations in the transaction occur, or none of them occur. An application can perform multiple operations and calculations in a single transaction.
A transaction is a set of Cloud Datastore operations on one or more entities. Each transaction is guaranteed to be atomic, which means that transactions are never partially applied. Either all of the operations in the transaction are applied, or none of them are applied. Transactions have a maximum duration of 60 seconds with a 10 second idle expiration time after 30 seconds.
An operation might fail when:
- Too many concurrent modifications are attempted on the same entity group.
- The transaction exceeds a resource limit.
- Cloud Datastore encounters an internal error.
In all these cases, the Cloud Datastore API raises an exception.
Transactions are an optional feature of Cloud Datastore; you're not required to use transactions to perform Cloud Datastore operations.
Here is an example of updating field named
vacationDays in an entity of kind