Skip to content

Commit 70c301f

Browse files
committed
remove old clients
1 parent ada5bfa commit 70c301f

29 files changed

Lines changed: 155 additions & 4305 deletions

Core/src/RequestProcessorTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use Google\Cloud\Core\Exception\ServiceException;
2525
use Google\Rpc\BadRequest;
2626
use Google\Rpc\Code;
27+
use Google\Rpc\RetryInfo;
2728

2829
/**
2930
* @internal

Spanner/src/Admin/Database/V1/DatabaseAdminClient.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

Spanner/src/Admin/Instance/V1/InstanceAdminClient.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

Spanner/src/Admin/Instance/V1/InstanceConfig.php

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Spanner/src/Database.php

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -130,23 +130,31 @@ class Database
130130
/**
131131
* @var bool
132132
*/
133-
private $isRunningTransaction = false;
133+
private bool $isRunningTransaction = false;
134134

135135
/**
136136
* @var array
137137
*/
138-
private $directedReadOptions;
138+
private array $directedReadOptions;
139139

140140
/**
141141
* @var bool
142142
*/
143-
private $routeToLeader;
143+
private bool $routeToLeader;
144144

145145
/**
146146
* @var array
147147
*/
148148
private $defaultQueryOptions;
149149

150+
private string $databaseRole;
151+
152+
private bool $returnInt64AsObject;
153+
154+
private ?SessionPoolInterface $sessionPool;
155+
156+
private array $info;
157+
150158
/**
151159
* @var array
152160
*/
@@ -169,18 +177,20 @@ class Database
169177
* @param Instance $instance The instance in which the database exists.
170178
* @param string $projectId The project ID.
171179
* @param string $name The database name or ID.
172-
* @param SessionPoolInterface $sessionPool [optional] The session pool
173-
* implementation.
174-
* @param bool $returnInt64AsObject [optional If true, 64 bit integers will
175-
* be returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
176-
* platform compatibility. **Defaults to** false.
177-
* @param string $databaseRole The user created database role which creates the session.
178-
* @param string $config [Optional] {
179-
* Configuration options.
180+
* @param string $options [Optional] {
181+
* Database options.
180182
*
181183
* @type bool $routeToLeader Enable/disable Leader Aware Routing.
182184
* **Defaults to** `true` (enabled).
183185
* @type array $defaultQueryOptions
186+
* @type SessionPoolInterface $sessionPool The session pool
187+
* implementation.
188+
* @type bool $returnInt64AsObject If true, 64 bit integers will
189+
* be returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
190+
* platform compatibility. **Defaults to** false.
191+
* @type string $databaseRole The user created database role which
192+
* creates the session.
193+
* @type array $database The database info.
184194
* }
185195
*/
186196
public function __construct(
@@ -190,22 +200,22 @@ public function __construct(
190200
private Instance $instance,
191201
private string $projectId,
192202
private string $name,
193-
private ?SessionPoolInterface $sessionPool = null,
194-
private bool $returnInt64AsObject = false,
195-
private array $info = [],
196-
private string $databaseRole = '',
197-
array $config = []
203+
array $options = [],
198204
) {
199205
$this->name = $this->fullyQualifiedDatabaseName($name);
200-
$this->routeToLeader = $config['routeToLeader'] ?? true;
201-
$this->defaultQueryOptions = $config['defaultQueryOptions'] ?? [];
206+
$this->routeToLeader = $options['routeToLeader'] ?? true;
207+
$this->defaultQueryOptions = $options['defaultQueryOptions'] ?? [];
208+
$this->databaseRole = $options['databaseRole'] ?? '';
209+
$this->returnInt64AsObject = $options['returnInt64AsObject'] ?? false;
210+
$this->sessionPool = $options['sessionPool'] ?? null;
211+
$this->info = $options['database'] ?? [];
202212
$this->operation = new Operation(
203213
$this->spannerClient,
204214
$serializer,
205-
$returnInt64AsObject,
206215
[
207216
'routeToLeader' => $this->routeToLeader,
208-
'defaultQueryOptions' => $this->defaultQueryOptions
217+
'defaultQueryOptions' => $this->defaultQueryOptions,
218+
'returnInt64AsObject' => $this->returnInt64AsObject,
209219
]
210220
);
211221

Spanner/src/Instance.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,20 @@ public function createDatabaseFromBackup($name, $backup, array $options = []): L
490490
* ```
491491
*
492492
* @param string $name The database name
493-
* @param array $options [optional] {
493+
* @param array $options {
494494
* Configuration options.
495495
*
496-
* @type SessionPoolInterface $sessionPool A pool used to manage
497-
* sessions.
498-
* @type string $databaseRole The user created database role which creates the session.
496+
* @type bool $routeToLeader Enable/disable Leader Aware Routing.
497+
* **Defaults to** `true` (enabled).
498+
* @type array $defaultQueryOptions
499+
* @type SessionPoolInterface $sessionPool The session pool
500+
* implementation.
501+
* @type bool $returnInt64AsObject If true, 64 bit integers will
502+
* be returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
503+
* platform compatibility. **Defaults to** false.
504+
* @type string $databaseRole The user created database role which
505+
* creates the session.
506+
* @type array $database The database info.
499507
* }
500508
* @return Database
501509
*/
@@ -508,13 +516,10 @@ public function database($name, array $options = []): Database
508516
$this,
509517
$this->projectId,
510518
$name,
511-
isset($options['sessionPool']) ? $options['sessionPool'] : null,
512-
$this->returnInt64AsObject,
513-
isset($options['database']) ? $options['database'] : [],
514-
isset($options['databaseRole']) ? $options['databaseRole'] : '',
515-
[
519+
$options + [
516520
'routeToLeader' => $this->routeToLeader,
517521
'defaultQueryOptions' => $this->defaultQueryOptions,
522+
'returnInt64AsObject' => $this->returnInt64AsObject,
518523
]
519524
);
520525
}

Spanner/src/Operation.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,23 @@ class Operation
7777
/**
7878
* @param SpannerClient $spannerClient The Spanner client used to make requests.
7979
* @param Serializer $serializer The serializer instance to encode/decode messages.
80-
* @param bool $returnInt64AsObject If true, 64 bit integers will be
81-
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
82-
* platform compatibility.
8380
* @param array $config [optional] {
8481
* Configuration options.
8582
*
8683
* @type bool $routeToLeader Enable/disable Leader Aware Routing.
8784
* **Defaults to** `true` (enabled).
8885
* @type array $defaultQueryOptions
86+
* @type bool $returnInt64AsObject If true, 64 bit integers will be
87+
* returned as a {@see \Google\Cloud\Core\Int64} object for 32 bit
88+
* platform compatibility.
8989
* }
9090
*/
9191
public function __construct(
9292
private SpannerClient $spannerClient,
9393
private Serializer $serializer,
94-
bool $returnInt64AsObject,
9594
$config = []
9695
) {
97-
$this->mapper = new ValueMapper($returnInt64AsObject);
96+
$this->mapper = new ValueMapper($options['returnInt64AsObject'] ?? false);
9897
$this->routeToLeader = $this->pluck('routeToLeader', $config, false) ?: true;
9998
$this->defaultQueryOptions =
10099
$this->pluck('defaultQueryOptions', $config, false) ?: [];

Spanner/src/SpannerClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,10 @@ public function batch($instanceId, $databaseId, array $options = [])
307307
$operation = new Operation(
308308
$this->spannerClient,
309309
$this->serializer,
310-
$this->returnInt64AsObject,
311310
[
312311
'routeToLeader' => $this->routeToLeader,
313-
'defaultQueryOptions' => $this->defaultQueryOptions
312+
'defaultQueryOptions' => $this->defaultQueryOptions,
313+
'returnInt64AsObject' => $this->returnInt64AsObject,
314314
]
315315
);
316316

Spanner/src/V1/ExecuteBatchDmlRequest.php

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Spanner/src/V1/ExecuteSqlRequest.php

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)