From 4df4371ddaa2ee05fbece4eaab6d9effd27a71ee Mon Sep 17 00:00:00 2001 From: Google APIs Date: Thu, 22 Aug 2019 13:20:27 -0700 Subject: [PATCH] Synchronize new proto/yaml changes. PiperOrigin-RevId: 264904482 --- google/spanner/v1/spanner.proto | 74 ++++++++++++++++++++++------ google/spanner/v1/spanner_gapic.yaml | 16 ++++++ 2 files changed, 74 insertions(+), 16 deletions(-) diff --git a/google/spanner/v1/spanner.proto b/google/spanner/v1/spanner.proto index b2091c92f7..a643e7a6c1 100644 --- a/google/spanner/v1/spanner.proto +++ b/google/spanner/v1/spanner.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google LLC. +// Copyright 2019 Google LLC. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -66,6 +66,18 @@ service Spanner { }; } + // Creates multiple new sessions. + // + // This API can be used to initialize a session cache on the clients. + // See https://goo.gl/TgSFN2 for best practices on session cache management. + rpc BatchCreateSessions(BatchCreateSessionsRequest) + returns (BatchCreateSessionsResponse) { + option (google.api.http) = { + post: "/v1/{database=projects/*/instances/*/databases/*}/sessions:batchCreate" + body: "*" + }; + } + // Gets a session. Returns `NOT_FOUND` if the session does not exist. // This is mainly useful for determining whether a session is still // alive. @@ -129,8 +141,9 @@ service Spanner { // // Statements are executed in order, sequentially. // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse] will contain a - // [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has successfully executed. If a - // statement fails, its error status will be returned as part of the + // [ResultSet][google.spanner.v1.ResultSet] for each DML statement that has + // successfully executed. If a statement fails, its error status will be + // returned as part of the // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. Execution will // stop at the first failed statement; the remaining statements will not run. // @@ -142,7 +155,8 @@ service Spanner { // See more details in // [ExecuteBatchDmlRequest][Spanner.ExecuteBatchDmlRequest] and // [ExecuteBatchDmlResponse][Spanner.ExecuteBatchDmlResponse]. - rpc ExecuteBatchDml(ExecuteBatchDmlRequest) returns (ExecuteBatchDmlResponse) { + rpc ExecuteBatchDml(ExecuteBatchDmlRequest) + returns (ExecuteBatchDmlResponse) { option (google.api.http) = { post: "/v1/{session=projects/*/instances/*/databases/*/sessions/*}:executeBatchDml" body: "*" @@ -275,6 +289,31 @@ message CreateSessionRequest { Session session = 2; } +// The request for +// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. +message BatchCreateSessionsRequest { + // Required. The database in which the new sessions are created. + string database = 1; + + // Parameters to be applied to each created session. + Session session_template = 2; + + // Required. The number of sessions to be created in this batch call. + // The API may return fewer than the requested number of sessions. If a + // specific number of sessions are desired, the client can make additional + // calls to BatchCreateSessions (adjusting + // [session_count][google.spanner.v1.BatchCreateSessionsRequest.session_count] + // as necessary). + int32 session_count = 3; +} + +// The response for +// [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions]. +message BatchCreateSessionsResponse { + // The freshly created sessions. + repeated Session session = 1; +} + // A session in the Cloud Spanner API. message Session { // The name of the session. This is always system-assigned; values provided @@ -371,9 +410,6 @@ message ExecuteSqlRequest { // Required. The session in which the SQL query should be performed. string session = 1; - // The transaction to use. If none is provided, the default is a - // temporary read-only transaction with strong concurrency. - // // The transaction to use. // // For queries, if none is provided, the default is a temporary read-only @@ -476,7 +512,9 @@ message ExecuteBatchDmlRequest { // It is not always possible for Cloud Spanner to infer the right SQL type // from a JSON value. For example, values of type `BYTES` and values - // of type `STRING` both appear in [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as JSON strings. + // of type `STRING` both appear in + // [params][google.spanner.v1.ExecuteBatchDmlRequest.Statement.params] as + // JSON strings. // // In these cases, `param_types` can be used to specify the exact // SQL type for some or all of the SQL statement parameters. See the @@ -508,11 +546,13 @@ message ExecuteBatchDmlRequest { int64 seqno = 4; } -// The response for [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list -// of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that has successfully executed. -// If a statement fails, the error is returned as part of the response payload. -// Clients can determine whether all DML statements have run successfully, or if -// a statement failed, using one of the following approaches: +// The response for +// [ExecuteBatchDml][google.spanner.v1.Spanner.ExecuteBatchDml]. Contains a list +// of [ResultSet][google.spanner.v1.ResultSet], one for each DML statement that +// has successfully executed. If a statement fails, the error is returned as +// part of the response payload. Clients can determine whether all DML +// statements have run successfully, or if a statement failed, using one of the +// following approaches: // // 1. Check if 'status' field is OkStatus. // 2. Check if result_sets_size() equals the number of statements in @@ -529,9 +569,11 @@ message ExecuteBatchDmlRequest { // result_set_size() client can determine that the 3rd statement has failed. message ExecuteBatchDmlResponse { // ResultSets, one for each statement in the request that ran successfully, in - // the same order as the statements in the request. Each [ResultSet][google.spanner.v1.ResultSet] will - // not contain any rows. The [ResultSetStats][google.spanner.v1.ResultSetStats] in each [ResultSet][google.spanner.v1.ResultSet] will - // contain the number of rows modified by the statement. + // the same order as the statements in the request. Each + // [ResultSet][google.spanner.v1.ResultSet] will not contain any rows. The + // [ResultSetStats][google.spanner.v1.ResultSetStats] in each + // [ResultSet][google.spanner.v1.ResultSet] will contain the number of rows + // modified by the statement. // // Only the first ResultSet in the response contains a valid // [ResultSetMetadata][google.spanner.v1.ResultSetMetadata]. diff --git a/google/spanner/v1/spanner_gapic.yaml b/google/spanner/v1/spanner_gapic.yaml index a09c021c64..3c34fd4ec9 100644 --- a/google/spanner/v1/spanner_gapic.yaml +++ b/google/spanner/v1/spanner_gapic.yaml @@ -82,6 +82,19 @@ interfaces: field_name_patterns: database: database timeout_millis: 30000 + - name: BatchCreateSessions + flattening: + groups: + - parameters: + - database + required_fields: + - database + resource_name_treatment: STATIC_TYPES + retry_codes_name: idempotent + retry_params_name: default + field_name_patterns: + database: database + timeout_millis: 60000 - name: GetSession flattening: groups: @@ -256,6 +269,9 @@ resource_name_generation: - message_name: CreateSessionRequest field_entity_map: database: database +- message_name: BatchCreateSessionsRequest + field_entity_map: + database: database - message_name: Session field_entity_map: name: session