@google-cloud/spanner 8.7.1 → 8.8.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/build/protos/google/spanner/v1/commit_response.proto +16 -0
- package/build/protos/google/spanner/v1/spanner.proto +55 -2
- package/build/protos/google/spanner/v1/transaction.proto +38 -18
- package/build/protos/protos.d.ts +1639 -1473
- package/build/protos/protos.js +13981 -9820
- package/build/protos/protos.json +296 -213
- package/build/src/codec.d.ts +10 -16
- package/build/src/codec.js +337 -68
- package/build/src/common-grpc/service.js +26 -16
- package/build/src/database.js +4 -1
- package/build/src/helper.d.ts +16 -0
- package/build/src/helper.js +89 -0
- package/build/src/index.js +20 -16
- package/build/src/instance.js +4 -1
- package/build/src/instrument.d.ts +10 -0
- package/build/src/instrument.js +74 -13
- package/build/src/metrics/metrics-tracer-factory.d.ts +1 -1
- package/build/src/metrics/metrics-tracer-factory.js +4 -4
- package/build/src/multiplexed-session.js +22 -19
- package/build/src/partial-result-stream.d.ts +11 -0
- package/build/src/partial-result-stream.js +79 -12
- package/build/src/request_id_header.js +12 -25
- package/build/src/session-pool.js +37 -34
- package/build/src/session.js +1 -1
- package/build/src/transaction.js +1 -1
- package/build/src/v1/spanner_client.d.ts +47 -4
- package/build/src/v1/spanner_client.js +47 -2
- package/build/src/v1/spanner_client_config.json +4 -0
- package/package.json +3 -11
|
@@ -16,7 +16,9 @@ syntax = "proto3";
|
|
|
16
16
|
|
|
17
17
|
package google.spanner.v1;
|
|
18
18
|
|
|
19
|
+
import "google/api/field_behavior.proto";
|
|
19
20
|
import "google/protobuf/timestamp.proto";
|
|
21
|
+
import "google/spanner/v1/location.proto";
|
|
20
22
|
import "google/spanner/v1/transaction.proto";
|
|
21
23
|
|
|
22
24
|
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
@@ -61,4 +63,18 @@ message CommitResponse {
|
|
|
61
63
|
// timestamp at which all reads in the transaction ran. This timestamp is
|
|
62
64
|
// never returned.
|
|
63
65
|
google.protobuf.Timestamp snapshot_timestamp = 5;
|
|
66
|
+
|
|
67
|
+
// Optional. A cache update expresses a set of changes the client should
|
|
68
|
+
// incorporate into its location cache. The client should discard the changes
|
|
69
|
+
// if they are older than the data it already has. This data can be obtained
|
|
70
|
+
// in response to requests that included a `RoutingHint` field, but may also
|
|
71
|
+
// be obtained by explicit location-fetching RPCs which may be added in the
|
|
72
|
+
// future.
|
|
73
|
+
CacheUpdate cache_update = 6 [(google.api.field_behavior) = OPTIONAL];
|
|
74
|
+
|
|
75
|
+
// The isolation level used for the read-write transaction.
|
|
76
|
+
TransactionOptions.IsolationLevel isolation_level = 7;
|
|
77
|
+
|
|
78
|
+
// The read lock mode used for the read-write transaction.
|
|
79
|
+
TransactionOptions.ReadWrite.ReadLockMode read_lock_mode = 8;
|
|
64
80
|
}
|
|
@@ -331,6 +331,23 @@ service Spanner {
|
|
|
331
331
|
};
|
|
332
332
|
option (google.api.method_signature) = "session,mutation_groups";
|
|
333
333
|
}
|
|
334
|
+
|
|
335
|
+
// Retrieves a cache update for a given database.
|
|
336
|
+
//
|
|
337
|
+
// This RPC can be used to warm up the client cache by fetching key recipes
|
|
338
|
+
// and server information for a given database. It is recommended to call
|
|
339
|
+
// this RPC at the beginning of the client's lifecycle, prior to any other
|
|
340
|
+
// data plane operations.
|
|
341
|
+
//
|
|
342
|
+
// The cache update is returned as a stream because the response can be too
|
|
343
|
+
// large to fit into a single `CacheUpdate` message.
|
|
344
|
+
rpc FetchCacheUpdate(FetchCacheUpdateRequest) returns (stream CacheUpdate) {
|
|
345
|
+
option (google.api.http) = {
|
|
346
|
+
post: "/v1/{database=projects/*/instances/*/databases/*}:cacheUpdate"
|
|
347
|
+
body: "*"
|
|
348
|
+
};
|
|
349
|
+
option (google.api.method_signature) = "database";
|
|
350
|
+
}
|
|
334
351
|
}
|
|
335
352
|
|
|
336
353
|
// The request for [CreateSession][google.spanner.v1.Spanner.CreateSession].
|
|
@@ -827,7 +844,7 @@ message ExecuteSqlRequest {
|
|
|
827
844
|
// be assumed until a subsequent `Commit` call completes successfully.
|
|
828
845
|
bool last_statement = 17 [(google.api.field_behavior) = OPTIONAL];
|
|
829
846
|
|
|
830
|
-
// Optional.
|
|
847
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
831
848
|
//
|
|
832
849
|
// It gives the server hints that can be used to route the request
|
|
833
850
|
// to an appropriate server, potentially significantly decreasing latency and
|
|
@@ -1268,7 +1285,7 @@ message ReadRequest {
|
|
|
1268
1285
|
// transactions.
|
|
1269
1286
|
LockHint lock_hint = 17 [(google.api.field_behavior) = OPTIONAL];
|
|
1270
1287
|
|
|
1271
|
-
// Optional.
|
|
1288
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1272
1289
|
//
|
|
1273
1290
|
// It gives the server hints that can be used to route the request
|
|
1274
1291
|
// to an appropriate server, potentially significantly decreasing latency and
|
|
@@ -1301,6 +1318,14 @@ message BeginTransactionRequest {
|
|
|
1301
1318
|
// randomly select one of the mutations from the mutation set and send it as a
|
|
1302
1319
|
// part of this request.
|
|
1303
1320
|
Mutation mutation_key = 4 [(google.api.field_behavior) = OPTIONAL];
|
|
1321
|
+
|
|
1322
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1323
|
+
//
|
|
1324
|
+
// It gives the server hints that can be used to route the request
|
|
1325
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
1326
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
1327
|
+
// filled in with accurate values.
|
|
1328
|
+
RoutingHint routing_hint = 5 [(google.api.field_behavior) = OPTIONAL];
|
|
1304
1329
|
}
|
|
1305
1330
|
|
|
1306
1331
|
// The request for [Commit][google.spanner.v1.Spanner.Commit].
|
|
@@ -1355,6 +1380,14 @@ message CommitRequest {
|
|
|
1355
1380
|
// results in a `FailedPrecondition` error.
|
|
1356
1381
|
MultiplexedSessionPrecommitToken precommit_token = 9
|
|
1357
1382
|
[(google.api.field_behavior) = OPTIONAL];
|
|
1383
|
+
|
|
1384
|
+
// Optional. Makes the Spanner requests location-aware if present.
|
|
1385
|
+
//
|
|
1386
|
+
// It gives the server hints that can be used to route the request
|
|
1387
|
+
// to an appropriate server, potentially significantly decreasing latency and
|
|
1388
|
+
// improving throughput. To achieve improved performance, most fields must be
|
|
1389
|
+
// filled in with accurate values.
|
|
1390
|
+
RoutingHint routing_hint = 10 [(google.api.field_behavior) = OPTIONAL];
|
|
1358
1391
|
}
|
|
1359
1392
|
|
|
1360
1393
|
// The request for [Rollback][google.spanner.v1.Spanner.Rollback].
|
|
@@ -1417,3 +1450,23 @@ message BatchWriteResponse {
|
|
|
1417
1450
|
// condition not being satisfied after evaluation.
|
|
1418
1451
|
google.protobuf.Timestamp commit_timestamp = 3;
|
|
1419
1452
|
}
|
|
1453
|
+
|
|
1454
|
+
// The request for
|
|
1455
|
+
// [FetchCacheUpdate][google.spanner.v1.Spanner.FetchCacheUpdate].
|
|
1456
|
+
message FetchCacheUpdateRequest {
|
|
1457
|
+
// Required. The database for which to retrieve the cache update.
|
|
1458
|
+
string database = 1 [
|
|
1459
|
+
(google.api.field_behavior) = REQUIRED,
|
|
1460
|
+
(google.api.resource_reference) = {
|
|
1461
|
+
type: "spanner.googleapis.com/Database"
|
|
1462
|
+
}
|
|
1463
|
+
];
|
|
1464
|
+
|
|
1465
|
+
// Optional. The maximum number of key recipes to return in the response.
|
|
1466
|
+
// If not set, a default limit of 100 will be used.
|
|
1467
|
+
int32 max_recipe_count = 2 [(google.api.field_behavior) = OPTIONAL];
|
|
1468
|
+
|
|
1469
|
+
// Optional. The maximum number of ranges to return in the response.
|
|
1470
|
+
// If not set, a default limit of 10000 will be used.
|
|
1471
|
+
int32 max_range_count = 3 [(google.api.field_behavior) = OPTIONAL];
|
|
1472
|
+
}
|
|
@@ -19,6 +19,7 @@ package google.spanner.v1;
|
|
|
19
19
|
import "google/api/field_behavior.proto";
|
|
20
20
|
import "google/protobuf/duration.proto";
|
|
21
21
|
import "google/protobuf/timestamp.proto";
|
|
22
|
+
import "google/spanner/v1/location.proto";
|
|
22
23
|
|
|
23
24
|
option csharp_namespace = "Google.Cloud.Spanner.V1";
|
|
24
25
|
option go_package = "cloud.google.com/go/spanner/apiv1/spannerpb;spannerpb";
|
|
@@ -39,35 +40,46 @@ message TransactionOptions {
|
|
|
39
40
|
// Default value.
|
|
40
41
|
//
|
|
41
42
|
// * If isolation level is
|
|
43
|
+
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE],
|
|
44
|
+
// locking semantics default to `PESSIMISTIC`.
|
|
45
|
+
// * If isolation level is
|
|
42
46
|
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ],
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
// 2. reads done as part of statements with a `LOCK_SCANNED_RANGES`
|
|
49
|
-
// hint
|
|
50
|
-
// 3. reads done as part of DML statements
|
|
51
|
-
// * At all other isolation levels, if `read_lock_mode` is the default
|
|
52
|
-
// value, then pessimistic read locks are used.
|
|
47
|
+
// locking semantics default to `OPTIMISTIC`.
|
|
48
|
+
// * See
|
|
49
|
+
// [Concurrency
|
|
50
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control)
|
|
51
|
+
// for more details.
|
|
53
52
|
READ_LOCK_MODE_UNSPECIFIED = 0;
|
|
54
53
|
|
|
55
54
|
// Pessimistic lock mode.
|
|
56
55
|
//
|
|
57
|
-
//
|
|
58
|
-
// Semantics described only applies to
|
|
56
|
+
// Lock acquisition behavior depends on the isolation level in use. In
|
|
59
57
|
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]
|
|
60
|
-
// isolation
|
|
58
|
+
// isolation, reads and writes acquire necessary locks during transaction
|
|
59
|
+
// statement execution. In
|
|
60
|
+
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]
|
|
61
|
+
// isolation, reads that explicitly request to be locked and writes
|
|
62
|
+
// acquire locks.
|
|
63
|
+
// See
|
|
64
|
+
// [Concurrency
|
|
65
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control) for
|
|
66
|
+
// details on the types of locks acquired at each transaction step.
|
|
61
67
|
PESSIMISTIC = 1;
|
|
62
68
|
|
|
63
69
|
// Optimistic lock mode.
|
|
64
70
|
//
|
|
65
|
-
//
|
|
66
|
-
//
|
|
67
|
-
// read/queried data has not changed since the transaction started.
|
|
68
|
-
// Semantics described only applies to
|
|
71
|
+
// Lock acquisition behavior depends on the isolation level in use. In
|
|
72
|
+
// both
|
|
69
73
|
// [SERIALIZABLE][google.spanner.v1.TransactionOptions.IsolationLevel.SERIALIZABLE]
|
|
70
|
-
//
|
|
74
|
+
// and
|
|
75
|
+
// [REPEATABLE_READ][google.spanner.v1.TransactionOptions.IsolationLevel.REPEATABLE_READ]
|
|
76
|
+
// isolation, reads and writes do not acquire locks during transaction
|
|
77
|
+
// statement execution.
|
|
78
|
+
// See
|
|
79
|
+
// [Concurrency
|
|
80
|
+
// control](https://cloud.google.com/spanner/docs/concurrency-control) for
|
|
81
|
+
// details on how the guarantees of each isolation level are provided at
|
|
82
|
+
// commit time.
|
|
71
83
|
OPTIMISTIC = 2;
|
|
72
84
|
}
|
|
73
85
|
|
|
@@ -264,6 +276,14 @@ message Transaction {
|
|
|
264
276
|
// attempt should be passed to the [Commit][google.spanner.v1.Spanner.Commit]
|
|
265
277
|
// request for this transaction.
|
|
266
278
|
MultiplexedSessionPrecommitToken precommit_token = 3;
|
|
279
|
+
|
|
280
|
+
// Optional. A cache update expresses a set of changes the client should
|
|
281
|
+
// incorporate into its location cache. The client should discard the changes
|
|
282
|
+
// if they are older than the data it already has. This data can be obtained
|
|
283
|
+
// in response to requests that included a `RoutingHint` field, but may also
|
|
284
|
+
// be obtained by explicit location-fetching RPCs which may be added in the
|
|
285
|
+
// future.
|
|
286
|
+
CacheUpdate cache_update = 5 [(google.api.field_behavior) = OPTIONAL];
|
|
267
287
|
}
|
|
268
288
|
|
|
269
289
|
// This message is used to select the transaction in which a
|