1
- // Copyright 2018 Google LLC.
1
+ // Copyright 2019 Google LLC.
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -66,6 +66,18 @@ service Spanner {
66
66
};
67
67
}
68
68
69
+ // Creates multiple new sessions.
70
+ //
71
+ // This API can be used to initialize a session cache on the clients.
72
+ // See https://goo.gl/TgSFN2 for best practices on session cache management.
73
+ rpc BatchCreateSessions (BatchCreateSessionsRequest )
74
+ returns (BatchCreateSessionsResponse ) {
75
+ option (google.api.http ) = {
76
+ post : "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate"
77
+ body : "*"
78
+ };
79
+ }
80
+
69
81
// Gets a session. Returns `NOT_FOUND` if the session does not exist.
70
82
// This is mainly useful for determining whether a session is still
71
83
// alive.
@@ -129,8 +141,9 @@ service Spanner {
129
141
//
130
142
// Statements are executed in order, sequentially.
131
143
// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a
132
- // [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a
133
- // statement fails, its error status will be returned as part of the
144
+ // [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has
145
+ // successfully executed. If a statement fails, its error status will be
146
+ // returned as part of the
134
147
// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will
135
148
// stop at the first failed statement; the remaining statements will not run.
136
149
//
@@ -142,7 +155,8 @@ service Spanner {
142
155
// See more details in
143
156
// [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and
144
157
// [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse].
145
- rpc ExecuteBatchDml (ExecuteBatchDmlRequest ) returns (ExecuteBatchDmlResponse ) {
158
+ rpc ExecuteBatchDml (ExecuteBatchDmlRequest )
159
+ returns (ExecuteBatchDmlResponse ) {
146
160
option (google.api.http ) = {
147
161
post : "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml"
148
162
body : "*"
@@ -275,6 +289,31 @@ message CreateSessionRequest {
275
289
Session session = 2 ;
276
290
}
277
291
292
+ // The request for
293
+ // [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
294
+ message BatchCreateSessionsRequest {
295
+ // Required. The database in which the new sessions are created.
296
+ string database = 1 ;
297
+
298
+ // Parameters to be applied to each created session.
299
+ Session session_template = 2 ;
300
+
301
+ // Required. The number of sessions to be created in this batch call.
302
+ // The API may return fewer than the requested number of sessions. If a
303
+ // specific number of sessions are desired, the client can make additional
304
+ // calls to BatchCreateSessions (adjusting
305
+ // [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count]
306
+ // as necessary).
307
+ int32 session_count = 3 ;
308
+ }
309
+
310
+ // The response for
311
+ // [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
312
+ message BatchCreateSessionsResponse {
313
+ // The freshly created sessions.
314
+ repeated Session session = 1 ;
315
+ }
316
+
278
317
// A session in the Cloud Spanner API.
279
318
message Session {
280
319
// The name of the session. This is always system-assigned; values provided
@@ -371,9 +410,6 @@ message ExecuteSqlRequest {
371
410
// Required. The session in which the SQL query should be performed.
372
411
string session = 1 ;
373
412
374
- // The transaction to use. If none is provided, the default is a
375
- // temporary read-only transaction with strong concurrency.
376
- //
377
413
// The transaction to use.
378
414
//
379
415
// For queries, if none is provided, the default is a temporary read-only
@@ -476,7 +512,9 @@ message ExecuteBatchDmlRequest {
476
512
477
513
// It is not always possible for Cloud Spanner to infer the right SQL type
478
514
// from a JSON value. For example, values of type `BYTES` and values
479
- // of type `STRING` both appear in [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as JSON strings.
515
+ // of type `STRING` both appear in
516
+ // [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as
517
+ // JSON strings.
480
518
//
481
519
// In these cases, `param_types` can be used to specify the exact
482
520
// SQL type for some or all of the SQL statement parameters. See the
@@ -508,11 +546,13 @@ message ExecuteBatchDmlRequest {
508
546
int64 seqno = 4 ;
509
547
}
510
548
511
- // The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
512
- // of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that has successfully executed.
513
- // If a statement fails, the error is returned as part of the response payload.
514
- // Clients can determine whether all DML statements have run successfully, or if
515
- // a statement failed, using one of the following approaches:
549
+ // The response for
550
+ // [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list
551
+ // of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that
552
+ // has successfully executed. If a statement fails, the error is returned as
553
+ // part of the response payload. Clients can determine whether all DML
554
+ // statements have run successfully, or if a statement failed, using one of the
555
+ // following approaches:
516
556
//
517
557
// 1. Check if 'status' field is OkStatus.
518
558
// 2. Check if result_sets_size() equals the number of statements in
@@ -529,9 +569,11 @@ message ExecuteBatchDmlRequest {
529
569
// result_set_size() client can determine that the 3rd statement has failed.
530
570
message ExecuteBatchDmlResponse {
531
571
// ResultSets, one for each statement in the request that ran successfully, in
532
- // the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will
533
- // not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will
534
- // contain the number of rows modified by the statement.
572
+ // the same order as the statements in the request. Each
573
+ // [ResultSet][google.spanner.v1.ResultSet] will not contain any rows. The
574
+ // [ResultSetStats][google.spanner.v1.ResultSetStats] in each
575
+ // [ResultSet][google.spanner.v1.ResultSet] will contain the number of rows
576
+ // modified by the statement.
535
577
//
536
578
// Only the first ResultSet in the response contains a valid
537
579
// [ResultSetMetadata][google.spanner.v1.ResultSetMetadata].
0 commit comments