Skip to content

Commit

Permalink
feat: protos for R/W transaction support on multiplexed sessions (#7736)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 683879049
Source-Link: googleapis/googleapis@2b6b93b
Source-Link: googleapis/googleapis-gen@2f0c933
Copy-Tag: eyJwIjoiU3Bhbm5lci8uT3dsQm90LnlhbWwiLCJoIjoiMmYwYzkzM2IwMDMxNjRkNWNkMTIwNTA1YTk4Yzg3Yzk1ODg4ZDk4ZiJ9
  • Loading branch information
gcf-owl-bot[bot] authored Oct 11, 2024
1 parent bb22cee commit dd48f72
Show file tree
Hide file tree
Showing 14 changed files with 638 additions and 0 deletions.
Binary file modified Spanner/metadata/V1/CommitResponse.php
Binary file not shown.
Binary file modified Spanner/metadata/V1/ResultSet.php
Binary file not shown.
Binary file modified Spanner/metadata/V1/Spanner.php
Binary file not shown.
Binary file modified Spanner/metadata/V1/Transaction.php
Binary file not shown.
64 changes: 64 additions & 0 deletions Spanner/src/V1/BeginTransactionRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions Spanner/src/V1/CommitRequest.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Spanner/src/V1/CommitResponse.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions Spanner/src/V1/ExecuteBatchDmlResponse.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions Spanner/src/V1/Gapic/SpannerGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
use Google\Cloud\Spanner\V1\KeySet;
use Google\Cloud\Spanner\V1\ListSessionsRequest;
use Google\Cloud\Spanner\V1\ListSessionsResponse;
use Google\Cloud\Spanner\V1\MultiplexedSessionPrecommitToken;
use Google\Cloud\Spanner\V1\Mutation;
use Google\Cloud\Spanner\V1\PartialResultSet;
use Google\Cloud\Spanner\V1\PartitionOptions;
Expand Down Expand Up @@ -534,6 +535,13 @@ public function batchWrite(
* request_options struct will not do anything. To set the priority for a
* transaction, set it on the reads and writes that are part of this
* transaction instead.
* @type Mutation $mutationKey
* Optional. Required for read-write transactions on a multiplexed session
* that commit mutations but do not perform any reads or queries. Clients
* should randomly select one of the mutations from the mutation set and send
* it as a part of this request.
* This feature is not yet supported and will result in an UNIMPLEMENTED
* error.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
Expand All @@ -558,6 +566,10 @@ public function beginTransaction(
$request->setRequestOptions($optionalArgs['requestOptions']);
}

if (isset($optionalArgs['mutationKey'])) {
$request->setMutationKey($optionalArgs['mutationKey']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down Expand Up @@ -631,6 +643,13 @@ public function beginTransaction(
* and 500 ms.
* @type RequestOptions $requestOptions
* Common options for this request.
* @type MultiplexedSessionPrecommitToken $precommitToken
* Optional. If the read-write transaction was executed on a multiplexed
* session, the precommit token with the highest sequence number received in
* this transaction attempt, should be included here. Failing to do so will
* result in a FailedPrecondition error.
* This feature is not yet supported and will result in an UNIMPLEMENTED
* error.
* @type RetrySettings|array $retrySettings
* Retry settings to use for this call. Can be a {@see RetrySettings} object, or an
* associative array of retry settings parameters. See the documentation on
Expand Down Expand Up @@ -670,6 +689,10 @@ public function commit($session, $mutations, array $optionalArgs = [])
$request->setRequestOptions($optionalArgs['requestOptions']);
}

if (isset($optionalArgs['precommitToken'])) {
$request->setPrecommitToken($optionalArgs['precommitToken']);
}

$requestParams = new RequestParamsHeaderDescriptor(
$requestParamHeaders
);
Expand Down
Loading

0 comments on commit dd48f72

Please sign in to comment.