Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions src/Spanner/CommitResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,60 @@

class CommitResponse extends \Google\Model
{
/**
* Default value. If the value is not specified, the `SERIALIZABLE` isolation
* level is used.
*/
public const ISOLATION_LEVEL_ISOLATION_LEVEL_UNSPECIFIED = 'ISOLATION_LEVEL_UNSPECIFIED';
/**
* All transactions appear as if they executed in a serial order, even if some
* of the reads, writes, and other operations of distinct transactions
* actually occurred in parallel. Spanner assigns commit timestamps that
* reflect the order of committed transactions to implement this property.
* Spanner offers a stronger guarantee than serializability called external
* consistency. For more information, see [TrueTime and external
* consistency](https://cloud.google.com/spanner/docs/true-time-external-
* consistency#serializability).
*/
public const ISOLATION_LEVEL_SERIALIZABLE = 'SERIALIZABLE';
/**
* All reads performed during the transaction observe a consistent snapshot of
* the database, and the transaction is only successfully committed in the
* absence of conflicts between its updates and any concurrent updates that
* have occurred since that snapshot. Consequently, in contrast to
* `SERIALIZABLE` transactions, only write-write conflicts are detected in
* snapshot transactions. This isolation level does not support read-only and
* partitioned DML transactions. When `REPEATABLE_READ` is specified on a
* read-write transaction, the locking semantics default to `OPTIMISTIC`.
*/
public const ISOLATION_LEVEL_REPEATABLE_READ = 'REPEATABLE_READ';
/**
* Default value. * If isolation level is SERIALIZABLE, locking semantics
* default to `PESSIMISTIC`. * If isolation level is REPEATABLE_READ, locking
* semantics default to `OPTIMISTIC`. * See [Concurrency
* control](https://cloud.google.com/spanner/docs/concurrency-control) for
* more details.
*/
public const READ_LOCK_MODE_READ_LOCK_MODE_UNSPECIFIED = 'READ_LOCK_MODE_UNSPECIFIED';
/**
* Pessimistic lock mode. Lock acquisition behavior depends on the isolation
* level in use. In SERIALIZABLE isolation, reads and writes acquire necessary
* locks during transaction statement execution. In REPEATABLE_READ isolation,
* reads that explicitly request to be locked and writes acquire locks. See
* [Concurrency control](https://cloud.google.com/spanner/docs/concurrency-
* control) for details on the types of locks acquired at each transaction
* step.
*/
public const READ_LOCK_MODE_PESSIMISTIC = 'PESSIMISTIC';
/**
* Optimistic lock mode. Lock acquisition behavior depends on the isolation
* level in use. In both SERIALIZABLE and REPEATABLE_READ isolation, reads and
* writes do not acquire locks during transaction statement execution. See
* [Concurrency control](https://cloud.google.com/spanner/docs/concurrency-
* control) for details on how the guarantees of each isolation level are
* provided at commit time.
*/
public const READ_LOCK_MODE_OPTIMISTIC = 'OPTIMISTIC';
protected $commitStatsType = CommitStats::class;
protected $commitStatsDataType = '';
/**
Expand All @@ -27,8 +81,20 @@ class CommitResponse extends \Google\Model
* @var string
*/
public $commitTimestamp;
/**
* The isolation level used for the read-write transaction.
*
* @var string
*/
public $isolationLevel;
protected $precommitTokenType = MultiplexedSessionPrecommitToken::class;
protected $precommitTokenDataType = '';
/**
* The read lock mode used for the read-write transaction.
*
* @var string
*/
public $readLockMode;
/**
* If `TransactionOptions.isolation_level` is set to
* `IsolationLevel.REPEATABLE_READ`, then the snapshot timestamp is the
Expand Down Expand Up @@ -72,6 +138,24 @@ public function getCommitTimestamp()
{
return $this->commitTimestamp;
}
/**
* The isolation level used for the read-write transaction.
*
* Accepted values: ISOLATION_LEVEL_UNSPECIFIED, SERIALIZABLE, REPEATABLE_READ
*
* @param self::ISOLATION_LEVEL_* $isolationLevel
*/
public function setIsolationLevel($isolationLevel)
{
$this->isolationLevel = $isolationLevel;
}
/**
* @return self::ISOLATION_LEVEL_*
*/
public function getIsolationLevel()
{
return $this->isolationLevel;
}
/**
* If specified, transaction has not committed yet. You must retry the commit
* with the new precommit token.
Expand All @@ -89,6 +173,24 @@ public function getPrecommitToken()
{
return $this->precommitToken;
}
/**
* The read lock mode used for the read-write transaction.
*
* Accepted values: READ_LOCK_MODE_UNSPECIFIED, PESSIMISTIC, OPTIMISTIC
*
* @param self::READ_LOCK_MODE_* $readLockMode
*/
public function setReadLockMode($readLockMode)
{
$this->readLockMode = $readLockMode;
}
/**
* @return self::READ_LOCK_MODE_*
*/
public function getReadLockMode()
{
return $this->readLockMode;
}
/**
* If `TransactionOptions.isolation_level` is set to
* `IsolationLevel.REPEATABLE_READ`, then the snapshot timestamp is the
Expand Down
20 changes: 14 additions & 6 deletions src/Spanner/InstancePartition.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class InstancePartition extends \Google\Collection
/**
* The number of nodes allocated to this instance partition. Users can set the
* `node_count` field to specify the target number of nodes allocated to the
* instance partition. If autoscaling is enabled, node_count is treated as an
* OUTPUT_ONLY field and reflects the current number of nodes allocated to the
* instance partition. This may be zero in API responses for instance
* partitions that are not yet in state `READY`.
*
Expand All @@ -95,9 +97,11 @@ class InstancePartition extends \Google\Collection
/**
* The number of processing units allocated to this instance partition. Users
* can set the `processing_units` field to specify the target number of
* processing units allocated to the instance partition. This might be zero in
* API responses for instance partitions that are not yet in the `READY`
* state.
* processing units allocated to the instance partition. If autoscaling is
* enabled, processing_units is treated as an OUTPUT_ONLY field and reflects
* the current number of processing units allocated to the instance partition.
* This might be zero in API responses for instance partitions that are not
* yet in the `READY` state.
*
* @var int
*/
Expand Down Expand Up @@ -253,6 +257,8 @@ public function getName()
/**
* The number of nodes allocated to this instance partition. Users can set the
* `node_count` field to specify the target number of nodes allocated to the
* instance partition. If autoscaling is enabled, node_count is treated as an
* OUTPUT_ONLY field and reflects the current number of nodes allocated to the
* instance partition. This may be zero in API responses for instance
* partitions that are not yet in state `READY`.
*
Expand All @@ -272,9 +278,11 @@ public function getNodeCount()
/**
* The number of processing units allocated to this instance partition. Users
* can set the `processing_units` field to specify the target number of
* processing units allocated to the instance partition. This might be zero in
* API responses for instance partitions that are not yet in the `READY`
* state.
* processing units allocated to the instance partition. If autoscaling is
* enabled, processing_units is treated as an OUTPUT_ONLY field and reflects
* the current number of processing units allocated to the instance partition.
* This might be zero in API responses for instance partitions that are not
* yet in the `READY` state.
*
* @param int $processingUnits
*/
Expand Down
Loading