@google-cloud/spanner 8.13.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -16
- package/build/src/batch-transaction.js +15 -12
- package/build/src/codec.d.ts +18 -30
- package/build/src/codec.js +197 -79
- package/build/src/common.d.ts +14 -0
- package/build/src/common.js +28 -3
- package/build/src/database.d.ts +31 -41
- package/build/src/database.js +147 -315
- package/build/src/helper.d.ts +12 -0
- package/build/src/helper.js +44 -0
- package/build/src/index.d.ts +24 -8
- package/build/src/index.js +303 -147
- package/build/src/instance.d.ts +15 -2
- package/build/src/instance.js +11 -2
- package/build/src/instrument.d.ts +12 -1
- package/build/src/instrument.js +13 -0
- package/build/src/metrics/constants.d.ts +13 -6
- package/build/src/metrics/constants.js +24 -14
- package/build/src/metrics/external-types.d.ts +14 -0
- package/build/src/metrics/interceptor.js +39 -44
- package/build/src/metrics/metrics-tracer-factory.d.ts +25 -14
- package/build/src/metrics/metrics-tracer-factory.js +119 -78
- package/build/src/metrics/metrics-tracer.d.ts +19 -6
- package/build/src/metrics/metrics-tracer.js +147 -55
- package/build/src/metrics/spanner-metrics-exporter.js +4 -0
- package/build/src/metrics/transform.d.ts +3 -4
- package/build/src/metrics/transform.js +16 -10
- package/build/src/multiplexed-session.d.ts +26 -2
- package/build/src/multiplexed-session.js +39 -11
- package/build/src/partial-result-stream.d.ts +26 -33
- package/build/src/partial-result-stream.js +263 -283
- package/build/src/request-stream-coordinator.d.ts +88 -0
- package/build/src/request-stream-coordinator.js +229 -0
- package/build/src/request_id_header.d.ts +6 -4
- package/build/src/request_id_header.js +24 -24
- package/build/src/session-factory.d.ts +62 -60
- package/build/src/session-factory.js +46 -86
- package/build/src/session-pool.d.ts +97 -227
- package/build/src/session-pool.js +74 -547
- package/build/src/session.js +1 -1
- package/build/src/transaction-runner.js +1 -12
- package/build/src/transaction.d.ts +21 -5
- package/build/src/transaction.js +107 -136
- package/package.json +28 -37
package/build/src/database.d.ts
CHANGED
|
@@ -54,6 +54,11 @@ type DatabaseResponse = [Database, r.Response];
|
|
|
54
54
|
type DatabaseCallback = ResourceCallback<Database, r.Response>;
|
|
55
55
|
type GetSnapshotCallback = NormalCallback<Snapshot>;
|
|
56
56
|
type GetTransactionCallback = NormalCallback<Transaction>;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated Session pool is deprecated and will be removed in a future release.
|
|
59
|
+
Multiplexed sessions are now used for all operations by default, eliminating
|
|
60
|
+
the need for session pooling.
|
|
61
|
+
*/
|
|
57
62
|
export interface SessionPoolConstructor {
|
|
58
63
|
new (database: Database, options?: SessionPoolOptions | null): SessionPoolInterface;
|
|
59
64
|
}
|
|
@@ -161,10 +166,15 @@ export interface WriteAtLeastOnceOptions extends CallOptions {
|
|
|
161
166
|
* @class
|
|
162
167
|
*
|
|
163
168
|
* @param {string} name Name of the database.
|
|
164
|
-
* @param {SessionPoolOptions|SessionPoolInterface}
|
|
165
|
-
* configuration options
|
|
166
|
-
*
|
|
169
|
+
* @param {SessionPoolOptions|SessionPoolInterface} [poolOptions] Session pool
|
|
170
|
+
* configuration options.
|
|
171
|
+
* **Deprecated**. Session pool options is deprecated and will be removed in a future release.
|
|
172
|
+
* Multiplexed sessions are now used for all operations by default, eliminating
|
|
173
|
+
* the need for session pooling.
|
|
174
|
+
* @param {google.spanner.v1.ExecuteSqlRequest.IQueryOptions} [queryOptions]
|
|
167
175
|
* The default query options to use for queries on the database.
|
|
176
|
+
* @param {string} [databaseRole] The database role to use for sessions on
|
|
177
|
+
* the database.
|
|
168
178
|
*
|
|
169
179
|
* @example
|
|
170
180
|
* ```
|
|
@@ -180,7 +190,6 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
180
190
|
pool_: SessionPoolInterface;
|
|
181
191
|
sessionFactory_: SessionFactoryInterface;
|
|
182
192
|
queryOptions_?: spannerClient.spanner.v1.ExecuteSqlRequest.IQueryOptions;
|
|
183
|
-
isMuxEnabledForRW_?: boolean;
|
|
184
193
|
commonHeaders_: {
|
|
185
194
|
[k: string]: string;
|
|
186
195
|
};
|
|
@@ -193,7 +202,14 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
193
202
|
_observabilityOptions?: ObservabilityOptions;
|
|
194
203
|
private _traceConfig;
|
|
195
204
|
private _nthRequest;
|
|
196
|
-
|
|
205
|
+
private _clientIdValue;
|
|
206
|
+
get _clientId(): number;
|
|
207
|
+
set _clientId(value: number);
|
|
208
|
+
private _channelIdValue;
|
|
209
|
+
get _channelId(): number;
|
|
210
|
+
set _channelId(value: number);
|
|
211
|
+
private _updateRequestIdPrefix;
|
|
212
|
+
_requestIdPrefix: string;
|
|
197
213
|
constructor(instance: Instance, name: string, poolOptions?: SessionPoolConstructor | SessionPoolOptions, queryOptions?: spannerClient.spanner.v1.ExecuteSqlRequest.IQueryOptions, databaseRole?: string | null);
|
|
198
214
|
_nextNthRequest(): number;
|
|
199
215
|
/**
|
|
@@ -359,7 +375,7 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
359
375
|
* @param {?Error} err Request error, if any.
|
|
360
376
|
*/
|
|
361
377
|
/**
|
|
362
|
-
* Close the database connection
|
|
378
|
+
* Close the database connection.
|
|
363
379
|
*
|
|
364
380
|
* @param {CloseDatabaseCallback} [callback] Callback function.
|
|
365
381
|
* @returns {Promise}
|
|
@@ -377,18 +393,6 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
377
393
|
* // Error handling omitted.
|
|
378
394
|
* }
|
|
379
395
|
* });
|
|
380
|
-
*
|
|
381
|
-
* //-
|
|
382
|
-
* // In the event of a session leak, the error object will contain a
|
|
383
|
-
* // `messages` field.
|
|
384
|
-
* //-
|
|
385
|
-
* database.close(function(err) {
|
|
386
|
-
* if (err && err.messages) {
|
|
387
|
-
* err.messages.forEach(function(message) {
|
|
388
|
-
* console.error(message);
|
|
389
|
-
* });
|
|
390
|
-
* }
|
|
391
|
-
* });
|
|
392
396
|
* ```
|
|
393
397
|
*/
|
|
394
398
|
close(callback: SessionPoolCloseCallback): void;
|
|
@@ -565,17 +569,6 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
565
569
|
createTable(schema: Schema, gaxOptions?: CallOptions): Promise<CreateTableResponse>;
|
|
566
570
|
createTable(schema: Schema, callback: CreateTableCallback): void;
|
|
567
571
|
createTable(schema: Schema, gaxOptions: CallOptions, callback: CreateTableCallback): void;
|
|
568
|
-
/**
|
|
569
|
-
* Decorates transaction so that when end() is called it will return the session
|
|
570
|
-
* back into the pool.
|
|
571
|
-
*
|
|
572
|
-
* @private
|
|
573
|
-
*
|
|
574
|
-
* @param {Session} session The session to release.
|
|
575
|
-
* @param {Transaction} transaction The transaction to observe.
|
|
576
|
-
* @returns {Transaction}
|
|
577
|
-
*/
|
|
578
|
-
private _releaseOnEnd;
|
|
579
572
|
/**
|
|
580
573
|
* @typedef {array} DatabaseDeleteResponse
|
|
581
574
|
* @property {object} 0 The full API response.
|
|
@@ -1109,8 +1102,7 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1109
1102
|
* Wrapper around {@link v1.SpannerClient#beginTransaction}.
|
|
1110
1103
|
*
|
|
1111
1104
|
* **NOTE:** When finished with the Snapshot, {@link Snapshot#end} should be
|
|
1112
|
-
* called to
|
|
1113
|
-
* result in a Session leak.**
|
|
1105
|
+
* called to end the snapshot transaction.
|
|
1114
1106
|
*
|
|
1115
1107
|
* **NOTE:** Since the returned {@link Snapshot} transaction is not a
|
|
1116
1108
|
* single-use transaction, it is invalid to set the `minReadTimestamp` and
|
|
@@ -1170,9 +1162,8 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1170
1162
|
*
|
|
1171
1163
|
* **NOTE:** In the event that you encounter an error while reading/writing,
|
|
1172
1164
|
* if you decide to forgo calling {@link Transaction#commit} or
|
|
1173
|
-
* {@link Transaction#rollback}, then you
|
|
1174
|
-
* {@link Transaction#end} to
|
|
1175
|
-
* **Failure to do could result in a Session leak.**
|
|
1165
|
+
* {@link Transaction#rollback}, then you should call
|
|
1166
|
+
* {@link Transaction#end} to end the transaction.
|
|
1176
1167
|
*
|
|
1177
1168
|
* Wrapper around {@link v1.SpannerClient#beginTransaction}.
|
|
1178
1169
|
*
|
|
@@ -1569,8 +1560,8 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1569
1560
|
run(query: string | ExecuteSqlRequest, options: TimestampBounds, callback: RunCallback): void;
|
|
1570
1561
|
/**
|
|
1571
1562
|
* Always runs the query through the full streaming pipeline (Database.prototype.runStream).
|
|
1572
|
-
* Used when runStream has been overridden on Database
|
|
1573
|
-
*
|
|
1563
|
+
* Used when runStream has been overridden on Database to preserve backward compatibility
|
|
1564
|
+
* with custom stream implementations.
|
|
1574
1565
|
*
|
|
1575
1566
|
* @private
|
|
1576
1567
|
*/
|
|
@@ -1587,13 +1578,13 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1587
1578
|
private _run;
|
|
1588
1579
|
/**
|
|
1589
1580
|
* Acquires a session and executes the query on a snapshot, managing span
|
|
1590
|
-
* lifetimes
|
|
1581
|
+
* lifetimes.
|
|
1591
1582
|
*
|
|
1592
1583
|
* @private
|
|
1593
1584
|
*/
|
|
1594
1585
|
private _executeRunOnSession;
|
|
1595
1586
|
/**
|
|
1596
|
-
* Executes the query on the snapshot
|
|
1587
|
+
* Executes the query on the snapshot.
|
|
1597
1588
|
*
|
|
1598
1589
|
* @private
|
|
1599
1590
|
*/
|
|
@@ -1772,9 +1763,8 @@ declare class Database extends common.GrpcServiceObject {
|
|
|
1772
1763
|
*
|
|
1773
1764
|
* **NOTE:** In the event that you encounter an error while reading/writing,
|
|
1774
1765
|
* if you decide to forgo calling {@link Transaction#commit} or
|
|
1775
|
-
* {@link Transaction#rollback}, then you
|
|
1776
|
-
* {@link Transaction#end} to
|
|
1777
|
-
* **Failure to do could result in a Session leak.**
|
|
1766
|
+
* {@link Transaction#rollback}, then you should call
|
|
1767
|
+
* {@link Transaction#end} to end the transaction.
|
|
1778
1768
|
*
|
|
1779
1769
|
* For a more complete listing of functionality available to a Transaction, see
|
|
1780
1770
|
* the {@link Transaction} API documentation. For a general overview of
|