google-cloud-spanner-v1 0.2.0 → 0.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1987ae143faf5fb07a8b7aaba8817d45fa9d5c50f8e8992e3c23c4196cfedb4
4
- data.tar.gz: 6e2ce947a4d318311aec8f49754d50534311fccedb1b0a2c3f373ef1c0687218
3
+ metadata.gz: 71197f1547efc77716d54ee66970d319818903cc4cb64cd8c5b6aee76e3aae71
4
+ data.tar.gz: 94ffeb7c16f48f6361008bcd5320209478dabdad29f23b3411698a0ff9b7dc85
5
5
  SHA512:
6
- metadata.gz: dca23479888976703e62d3dbdb449a2f47d8346bafbccb232a7c5db3a482b9e380c59d74ff15cf271e35be1aceafbcc735c974333833ba31dadb7e2d8068d8d6
7
- data.tar.gz: db217dce4d7646dc81b989766e3795b8280ffd779fb888124d9cff793c8a8360967c21b556cab7b7e460dc1c0af0ae50ae87a8a305accfd050887de5e794fc49
6
+ metadata.gz: b225156eca4504414c777afa938296d05cb2602cf29b40d04c48091a86dfc74c91fc8ad4b79290c85a43182f758a1b2a3f3661057ffea51f1383e65001a9c842
7
+ data.tar.gz: 4bd2aba2852364d10ae43ea63620d1ad18f813f73844dadbbfccdbd9ab1bb6795af3d187a4d3f57cdce8a3cb159e636e45255ffb8cfb264f241f1114aafaa641
data/README.md CHANGED
@@ -6,6 +6,12 @@ Cloud Spanner is a managed, mission-critical, globally consistent and scalable r
6
6
 
7
7
  https://github.com/googleapis/google-cloud-ruby
8
8
 
9
+ This gem is a _versioned_ client. It provides basic client classes for a
10
+ specific version of the Cloud Spanner V1 API. Most users should consider using
11
+ the main client gem,
12
+ [google-cloud-spanner](https://rubygems.org/gems/google-cloud-spanner).
13
+ See the section below titled *Which client should I use?* for more information.
14
+
9
15
  ## Installation
10
16
 
11
17
  ```
@@ -73,3 +79,61 @@ in security maintenance, and not end of life. Currently, this means Ruby 2.4
73
79
  and later. Older versions of Ruby _may_ still work, but are unsupported and not
74
80
  recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
75
81
  about the Ruby support schedule.
82
+
83
+ ## Which client should I use?
84
+
85
+ Most modern Ruby client libraries for Google APIs come in two flavors: the main
86
+ client library with a name such as `google-cloud-spanner`,
87
+ and lower-level _versioned_ client libraries with names such as
88
+ `google-cloud-spanner-v1`.
89
+ _In most cases, you should install the main client._
90
+
91
+ ### What's the difference between the main client and a versioned client?
92
+
93
+ A _versioned client_ provides a basic set of data types and client classes for
94
+ a _single version_ of a specific service. (That is, for a service with multiple
95
+ versions, there might be a separate versioned client for each service version.)
96
+ Most versioned clients are written and maintained by a code generator.
97
+
98
+ The _main client_ is designed to provide you with the _recommended_ client
99
+ interfaces for the service. There will be only one main client for any given
100
+ service, even a service with multiple versions. The main client includes
101
+ factory methods for constructing the client objects we recommend for most
102
+ users. In some cases, those will be classes provided by an underlying versioned
103
+ client; in other cases, they will be handwritten higher-level client objects
104
+ with additional capabilities, convenience methods, or best practices built in.
105
+ Generally, the main client will default to a recommended service version,
106
+ although in some cases you can override this if you need to talk to a specific
107
+ service version.
108
+
109
+ ### Why would I want to use the main client?
110
+
111
+ We recommend that most users install the main client gem for a service. You can
112
+ identify this gem as the one _without_ a version in its name, e.g.
113
+ `google-cloud-spanner`.
114
+ The main client is recommended because it will embody the best practices for
115
+ accessing the service, and may also provide more convenient interfaces or
116
+ tighter integration into frameworks and third-party libraries. In addition, the
117
+ documentation and samples published by Google will generally demonstrate use of
118
+ the main client.
119
+
120
+ ### Why would I want to use a versioned client?
121
+
122
+ You can use a versioned client if you are content with a possibly lower-level
123
+ class interface, you explicitly want to avoid features provided by the main
124
+ client, or you want to access a specific service version not be covered by the
125
+ main client. You can identify versioned client gems because the service version
126
+ is part of the name, e.g. `google-cloud-spanner-v1`.
127
+
128
+ ### What about the google-apis-<name> clients?
129
+
130
+ Client library gems with names that begin with `google-apis-` are based on an
131
+ older code generation technology. They talk to a REST/JSON backend (whereas
132
+ most modern clients talk to a [gRPC](https://grpc.io/) backend) and they may
133
+ not offer the same performance, features, and ease of use provided by more
134
+ modern clients.
135
+
136
+ The `google-apis-` clients have wide coverage across Google services, so you
137
+ might need to use one if there is no modern client available for the service.
138
+ However, if a modern client is available, we generally recommend it over the
139
+ older `google-apis-` clients.
@@ -33,3 +33,6 @@ module Google
33
33
  end
34
34
  end
35
35
  end
36
+
37
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
38
+ require "google/cloud/spanner/v1/_helpers" if ::File.file? helper_path
@@ -73,7 +73,7 @@ module Google
73
73
  initial_delay: 0.25,
74
74
  max_delay: 32.0,
75
75
  multiplier: 1.3,
76
- retry_codes: ["UNAVAILABLE"]
76
+ retry_codes: [14]
77
77
  }
78
78
 
79
79
  default_config.rpcs.batch_create_sessions.timeout = 60.0
@@ -81,7 +81,7 @@ module Google
81
81
  initial_delay: 0.25,
82
82
  max_delay: 32.0,
83
83
  multiplier: 1.3,
84
- retry_codes: ["UNAVAILABLE"]
84
+ retry_codes: [14]
85
85
  }
86
86
 
87
87
  default_config.rpcs.get_session.timeout = 30.0
@@ -89,7 +89,7 @@ module Google
89
89
  initial_delay: 0.25,
90
90
  max_delay: 32.0,
91
91
  multiplier: 1.3,
92
- retry_codes: ["UNAVAILABLE"]
92
+ retry_codes: [14]
93
93
  }
94
94
 
95
95
  default_config.rpcs.list_sessions.timeout = 3600.0
@@ -97,7 +97,7 @@ module Google
97
97
  initial_delay: 0.25,
98
98
  max_delay: 32.0,
99
99
  multiplier: 1.3,
100
- retry_codes: ["UNAVAILABLE"]
100
+ retry_codes: [14]
101
101
  }
102
102
 
103
103
  default_config.rpcs.delete_session.timeout = 30.0
@@ -105,7 +105,7 @@ module Google
105
105
  initial_delay: 0.25,
106
106
  max_delay: 32.0,
107
107
  multiplier: 1.3,
108
- retry_codes: ["UNAVAILABLE"]
108
+ retry_codes: [14]
109
109
  }
110
110
 
111
111
  default_config.rpcs.execute_sql.timeout = 30.0
@@ -113,7 +113,7 @@ module Google
113
113
  initial_delay: 0.25,
114
114
  max_delay: 32.0,
115
115
  multiplier: 1.3,
116
- retry_codes: ["UNAVAILABLE"]
116
+ retry_codes: [14]
117
117
  }
118
118
 
119
119
  default_config.rpcs.execute_streaming_sql.timeout = 3600.0
@@ -123,7 +123,7 @@ module Google
123
123
  initial_delay: 0.25,
124
124
  max_delay: 32.0,
125
125
  multiplier: 1.3,
126
- retry_codes: ["UNAVAILABLE"]
126
+ retry_codes: [14]
127
127
  }
128
128
 
129
129
  default_config.rpcs.read.timeout = 30.0
@@ -131,7 +131,7 @@ module Google
131
131
  initial_delay: 0.25,
132
132
  max_delay: 32.0,
133
133
  multiplier: 1.3,
134
- retry_codes: ["UNAVAILABLE"]
134
+ retry_codes: [14]
135
135
  }
136
136
 
137
137
  default_config.rpcs.streaming_read.timeout = 3600.0
@@ -141,7 +141,7 @@ module Google
141
141
  initial_delay: 0.25,
142
142
  max_delay: 32.0,
143
143
  multiplier: 1.3,
144
- retry_codes: ["UNAVAILABLE"]
144
+ retry_codes: [14]
145
145
  }
146
146
 
147
147
  default_config.rpcs.commit.timeout = 3600.0
@@ -149,7 +149,7 @@ module Google
149
149
  initial_delay: 0.25,
150
150
  max_delay: 32.0,
151
151
  multiplier: 1.3,
152
- retry_codes: ["UNAVAILABLE"]
152
+ retry_codes: [14]
153
153
  }
154
154
 
155
155
  default_config.rpcs.rollback.timeout = 30.0
@@ -157,7 +157,7 @@ module Google
157
157
  initial_delay: 0.25,
158
158
  max_delay: 32.0,
159
159
  multiplier: 1.3,
160
- retry_codes: ["UNAVAILABLE"]
160
+ retry_codes: [14]
161
161
  }
162
162
 
163
163
  default_config.rpcs.partition_query.timeout = 30.0
@@ -165,7 +165,7 @@ module Google
165
165
  initial_delay: 0.25,
166
166
  max_delay: 32.0,
167
167
  multiplier: 1.3,
168
- retry_codes: ["UNAVAILABLE"]
168
+ retry_codes: [14]
169
169
  }
170
170
 
171
171
  default_config.rpcs.partition_read.timeout = 30.0
@@ -173,7 +173,7 @@ module Google
173
173
  initial_delay: 0.25,
174
174
  max_delay: 32.0,
175
175
  multiplier: 1.3,
176
- retry_codes: ["UNAVAILABLE"]
176
+ retry_codes: [14]
177
177
  }
178
178
 
179
179
  default_config
@@ -237,7 +237,13 @@ module Google
237
237
 
238
238
  # Create credentials
239
239
  credentials = @config.credentials
240
- credentials ||= Credentials.default scope: @config.scope
240
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
241
+ # but only if the default endpoint does not have a region prefix.
242
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
243
+ @config.endpoint == Client.configure.endpoint &&
244
+ !@config.endpoint.split(".").first.include?("-")
245
+ credentials ||= Credentials.default scope: @config.scope,
246
+ enable_self_signed_jwt: enable_self_signed_jwt
241
247
  if credentials.is_a?(String) || credentials.is_a?(Hash)
242
248
  credentials = Credentials.new credentials, scope: @config.scope
243
249
  end
@@ -686,8 +692,9 @@ module Google
686
692
  # Parameter names and values that bind to placeholders in the SQL string.
687
693
  #
688
694
  # A parameter placeholder consists of the `@` character followed by the
689
- # parameter name (for example, `@firstName`). Parameter names can contain
690
- # letters, numbers, and underscores.
695
+ # parameter name (for example, `@firstName`). Parameter names must conform
696
+ # to the naming requirements of identifiers as specified at
697
+ # https://cloud.google.com/spanner/docs/lexical#identifiers.
691
698
  #
692
699
  # Parameters can appear anywhere that a literal value is expected. The same
693
700
  # parameter name can be used more than once, for example:
@@ -820,8 +827,9 @@ module Google
820
827
  # Parameter names and values that bind to placeholders in the SQL string.
821
828
  #
822
829
  # A parameter placeholder consists of the `@` character followed by the
823
- # parameter name (for example, `@firstName`). Parameter names can contain
824
- # letters, numbers, and underscores.
830
+ # parameter name (for example, `@firstName`). Parameter names must conform
831
+ # to the naming requirements of identifiers as specified at
832
+ # https://cloud.google.com/spanner/docs/lexical#identifiers.
825
833
  #
826
834
  # Parameters can appear anywhere that a literal value is expected. The same
827
835
  # parameter name can be used more than once, for example:
@@ -1322,6 +1330,12 @@ module Google
1322
1330
  # reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
1323
1331
  # the transaction from the beginning, re-using the same session.
1324
1332
  #
1333
+ # On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
1334
+ # for example, if the client job experiences a 1+ hour networking failure.
1335
+ # At that point, Cloud Spanner has lost track of the transaction outcome and
1336
+ # we recommend that you perform another read from the database to see the
1337
+ # state of things as they are now.
1338
+ #
1325
1339
  # @overload commit(request, options = nil)
1326
1340
  # Pass arguments to `commit` via a request object, either of type
1327
1341
  # {::Google::Cloud::Spanner::V1::CommitRequest} or an equivalent Hash.
@@ -1332,7 +1346,7 @@ module Google
1332
1346
  # @param options [::Gapic::CallOptions, ::Hash]
1333
1347
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1334
1348
  #
1335
- # @overload commit(session: nil, transaction_id: nil, single_use_transaction: nil, mutations: nil)
1349
+ # @overload commit(session: nil, transaction_id: nil, single_use_transaction: nil, mutations: nil, return_commit_stats: nil)
1336
1350
  # Pass arguments to `commit` via keyword arguments. Note that at
1337
1351
  # least one keyword argument is required. To specify no parameters, or to keep all
1338
1352
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1355,6 +1369,10 @@ module Google
1355
1369
  # The mutations to be executed when this transaction commits. All
1356
1370
  # mutations are applied atomically, in the order they appear in
1357
1371
  # this list.
1372
+ # @param return_commit_stats [::Boolean]
1373
+ # If `true`, then statistics related to the transaction will be included in
1374
+ # the {::Google::Cloud::Spanner::V1::CommitResponse#commit_stats CommitResponse}. Default value is
1375
+ # `false`.
1358
1376
  #
1359
1377
  # @yield [response, operation] Access the result along with the RPC operation
1360
1378
  # @yieldparam response [::Google::Cloud::Spanner::V1::CommitResponse]
@@ -1775,7 +1793,7 @@ module Google
1775
1793
 
1776
1794
  config_attr :endpoint, "spanner.googleapis.com", ::String
1777
1795
  config_attr :credentials, nil do |value|
1778
- allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1796
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1779
1797
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1780
1798
  allowed.any? { |klass| klass === value }
1781
1799
  end
@@ -1815,7 +1833,7 @@ module Google
1815
1833
  # Each configuration object is of type `Gapic::Config::Method` and includes
1816
1834
  # the following configuration fields:
1817
1835
  #
1818
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1836
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1819
1837
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1820
1838
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1821
1839
  # include the following keys:
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Spanner
23
23
  module V1
24
- VERSION = "0.2.0"
24
+ VERSION = "0.4.0"
25
25
  end
26
26
  end
27
27
  end
@@ -7,6 +7,7 @@ require 'google/api/annotations_pb'
7
7
  require 'google/api/client_pb'
8
8
  require 'google/api/field_behavior_pb'
9
9
  require 'google/api/resource_pb'
10
+ require 'google/protobuf/duration_pb'
10
11
  require 'google/protobuf/empty_pb'
11
12
  require 'google/protobuf/struct_pb'
12
13
  require 'google/protobuf/timestamp_pb'
@@ -133,6 +134,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
133
134
  add_message "google.spanner.v1.CommitRequest" do
134
135
  optional :session, :string, 1
135
136
  repeated :mutations, :message, 4, "google.spanner.v1.Mutation"
137
+ optional :return_commit_stats, :bool, 5
136
138
  oneof :transaction do
137
139
  optional :transaction_id, :bytes, 2
138
140
  optional :single_use_transaction, :message, 3, "google.spanner.v1.TransactionOptions"
@@ -140,6 +142,10 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
140
142
  end
141
143
  add_message "google.spanner.v1.CommitResponse" do
142
144
  optional :commit_timestamp, :message, 1, "google.protobuf.Timestamp"
145
+ optional :commit_stats, :message, 2, "google.spanner.v1.CommitResponse.CommitStats"
146
+ end
147
+ add_message "google.spanner.v1.CommitResponse.CommitStats" do
148
+ optional :mutation_count, :int64, 1
143
149
  end
144
150
  add_message "google.spanner.v1.RollbackRequest" do
145
151
  optional :session, :string, 1
@@ -175,6 +181,7 @@ module Google
175
181
  BeginTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.v1.BeginTransactionRequest").msgclass
176
182
  CommitRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.v1.CommitRequest").msgclass
177
183
  CommitResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.v1.CommitResponse").msgclass
184
+ CommitResponse::CommitStats = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.v1.CommitResponse.CommitStats").msgclass
178
185
  RollbackRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.spanner.v1.RollbackRequest").msgclass
179
186
  end
180
187
  end
@@ -55,22 +55,22 @@ module Google
55
55
  #
56
56
  # Idle sessions can be kept alive by sending a trivial SQL query
57
57
  # periodically, e.g., `"SELECT 1"`.
58
- rpc :CreateSession, Google::Cloud::Spanner::V1::CreateSessionRequest, Google::Cloud::Spanner::V1::Session
58
+ rpc :CreateSession, ::Google::Cloud::Spanner::V1::CreateSessionRequest, ::Google::Cloud::Spanner::V1::Session
59
59
  # Creates multiple new sessions.
60
60
  #
61
61
  # This API can be used to initialize a session cache on the clients.
62
62
  # See https://goo.gl/TgSFN2 for best practices on session cache management.
63
- rpc :BatchCreateSessions, Google::Cloud::Spanner::V1::BatchCreateSessionsRequest, Google::Cloud::Spanner::V1::BatchCreateSessionsResponse
63
+ rpc :BatchCreateSessions, ::Google::Cloud::Spanner::V1::BatchCreateSessionsRequest, ::Google::Cloud::Spanner::V1::BatchCreateSessionsResponse
64
64
  # Gets a session. Returns `NOT_FOUND` if the session does not exist.
65
65
  # This is mainly useful for determining whether a session is still
66
66
  # alive.
67
- rpc :GetSession, Google::Cloud::Spanner::V1::GetSessionRequest, Google::Cloud::Spanner::V1::Session
67
+ rpc :GetSession, ::Google::Cloud::Spanner::V1::GetSessionRequest, ::Google::Cloud::Spanner::V1::Session
68
68
  # Lists all sessions in a given database.
69
- rpc :ListSessions, Google::Cloud::Spanner::V1::ListSessionsRequest, Google::Cloud::Spanner::V1::ListSessionsResponse
69
+ rpc :ListSessions, ::Google::Cloud::Spanner::V1::ListSessionsRequest, ::Google::Cloud::Spanner::V1::ListSessionsResponse
70
70
  # Ends a session, releasing server resources associated with it. This will
71
71
  # asynchronously trigger cancellation of any operations that are running with
72
72
  # this session.
73
- rpc :DeleteSession, Google::Cloud::Spanner::V1::DeleteSessionRequest, Google::Protobuf::Empty
73
+ rpc :DeleteSession, ::Google::Cloud::Spanner::V1::DeleteSessionRequest, ::Google::Protobuf::Empty
74
74
  # Executes an SQL statement, returning all results in a single reply. This
75
75
  # method cannot be used to return a result set larger than 10 MiB;
76
76
  # if the query yields more data than that, the query fails with
@@ -82,13 +82,13 @@ module Google
82
82
  #
83
83
  # Larger result sets can be fetched in streaming fashion by calling
84
84
  # [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] instead.
85
- rpc :ExecuteSql, Google::Cloud::Spanner::V1::ExecuteSqlRequest, Google::Cloud::Spanner::V1::ResultSet
85
+ rpc :ExecuteSql, ::Google::Cloud::Spanner::V1::ExecuteSqlRequest, ::Google::Cloud::Spanner::V1::ResultSet
86
86
  # Like [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], except returns the result
87
87
  # set as a stream. Unlike [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql], there
88
88
  # is no limit on the size of the returned result set. However, no
89
89
  # individual row in the result set can exceed 100 MiB, and no
90
90
  # column value can exceed 10 MiB.
91
- rpc :ExecuteStreamingSql, Google::Cloud::Spanner::V1::ExecuteSqlRequest, stream(Google::Cloud::Spanner::V1::PartialResultSet)
91
+ rpc :ExecuteStreamingSql, ::Google::Cloud::Spanner::V1::ExecuteSqlRequest, stream(::Google::Cloud::Spanner::V1::PartialResultSet)
92
92
  # Executes a batch of SQL DML statements. This method allows many statements
93
93
  # to be run with lower latency than submitting them sequentially with
94
94
  # [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql].
@@ -100,7 +100,7 @@ module Google
100
100
  #
101
101
  # Execution stops after the first failed statement; the remaining statements
102
102
  # are not executed.
103
- rpc :ExecuteBatchDml, Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest, Google::Cloud::Spanner::V1::ExecuteBatchDmlResponse
103
+ rpc :ExecuteBatchDml, ::Google::Cloud::Spanner::V1::ExecuteBatchDmlRequest, ::Google::Cloud::Spanner::V1::ExecuteBatchDmlResponse
104
104
  # Reads rows from the database using key lookups and scans, as a
105
105
  # simple key/value style alternative to
106
106
  # [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql]. This method cannot be used to
@@ -114,18 +114,18 @@ module Google
114
114
  #
115
115
  # Larger result sets can be yielded in streaming fashion by calling
116
116
  # [StreamingRead][google.spanner.v1.Spanner.StreamingRead] instead.
117
- rpc :Read, Google::Cloud::Spanner::V1::ReadRequest, Google::Cloud::Spanner::V1::ResultSet
117
+ rpc :Read, ::Google::Cloud::Spanner::V1::ReadRequest, ::Google::Cloud::Spanner::V1::ResultSet
118
118
  # Like [Read][google.spanner.v1.Spanner.Read], except returns the result set as a
119
119
  # stream. Unlike [Read][google.spanner.v1.Spanner.Read], there is no limit on the
120
120
  # size of the returned result set. However, no individual row in
121
121
  # the result set can exceed 100 MiB, and no column value can exceed
122
122
  # 10 MiB.
123
- rpc :StreamingRead, Google::Cloud::Spanner::V1::ReadRequest, stream(Google::Cloud::Spanner::V1::PartialResultSet)
123
+ rpc :StreamingRead, ::Google::Cloud::Spanner::V1::ReadRequest, stream(::Google::Cloud::Spanner::V1::PartialResultSet)
124
124
  # Begins a new transaction. This step can often be skipped:
125
125
  # [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and
126
126
  # [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a
127
127
  # side-effect.
128
- rpc :BeginTransaction, Google::Cloud::Spanner::V1::BeginTransactionRequest, Google::Cloud::Spanner::V1::Transaction
128
+ rpc :BeginTransaction, ::Google::Cloud::Spanner::V1::BeginTransactionRequest, ::Google::Cloud::Spanner::V1::Transaction
129
129
  # Commits a transaction. The request includes the mutations to be
130
130
  # applied to rows in the database.
131
131
  #
@@ -134,7 +134,13 @@ module Google
134
134
  # transactions. However, it can also happen for a variety of other
135
135
  # reasons. If `Commit` returns `ABORTED`, the caller should re-attempt
136
136
  # the transaction from the beginning, re-using the same session.
137
- rpc :Commit, Google::Cloud::Spanner::V1::CommitRequest, Google::Cloud::Spanner::V1::CommitResponse
137
+ #
138
+ # On very rare occasions, `Commit` might return `UNKNOWN`. This can happen,
139
+ # for example, if the client job experiences a 1+ hour networking failure.
140
+ # At that point, Cloud Spanner has lost track of the transaction outcome and
141
+ # we recommend that you perform another read from the database to see the
142
+ # state of things as they are now.
143
+ rpc :Commit, ::Google::Cloud::Spanner::V1::CommitRequest, ::Google::Cloud::Spanner::V1::CommitResponse
138
144
  # Rolls back a transaction, releasing any locks it holds. It is a good
139
145
  # idea to call this for any transaction that includes one or more
140
146
  # [Read][google.spanner.v1.Spanner.Read] or [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] requests and
@@ -143,7 +149,7 @@ module Google
143
149
  # `Rollback` returns `OK` if it successfully aborts the transaction, the
144
150
  # transaction was already aborted, or the transaction is not
145
151
  # found. `Rollback` never returns `ABORTED`.
146
- rpc :Rollback, Google::Cloud::Spanner::V1::RollbackRequest, Google::Protobuf::Empty
152
+ rpc :Rollback, ::Google::Cloud::Spanner::V1::RollbackRequest, ::Google::Protobuf::Empty
147
153
  # Creates a set of partition tokens that can be used to execute a query
148
154
  # operation in parallel. Each of the returned partition tokens can be used
149
155
  # by [ExecuteStreamingSql][google.spanner.v1.Spanner.ExecuteStreamingSql] to specify a subset
@@ -155,7 +161,7 @@ module Google
155
161
  # is deleted, is idle for too long, begins a new transaction, or becomes too
156
162
  # old. When any of these happen, it is not possible to resume the query, and
157
163
  # the whole operation must be restarted from the beginning.
158
- rpc :PartitionQuery, Google::Cloud::Spanner::V1::PartitionQueryRequest, Google::Cloud::Spanner::V1::PartitionResponse
164
+ rpc :PartitionQuery, ::Google::Cloud::Spanner::V1::PartitionQueryRequest, ::Google::Cloud::Spanner::V1::PartitionResponse
159
165
  # Creates a set of partition tokens that can be used to execute a read
160
166
  # operation in parallel. Each of the returned partition tokens can be used
161
167
  # by [StreamingRead][google.spanner.v1.Spanner.StreamingRead] to specify a subset of the read
@@ -169,7 +175,7 @@ module Google
169
175
  # is deleted, is idle for too long, begins a new transaction, or becomes too
170
176
  # old. When any of these happen, it is not possible to resume the read, and
171
177
  # the whole operation must be restarted from the beginning.
172
- rpc :PartitionRead, Google::Cloud::Spanner::V1::PartitionReadRequest, Google::Cloud::Spanner::V1::PartitionResponse
178
+ rpc :PartitionRead, ::Google::Cloud::Spanner::V1::PartitionReadRequest, ::Google::Cloud::Spanner::V1::PartitionResponse
173
179
  end
174
180
 
175
181
  Stub = Service.rpc_stub_class
@@ -54,6 +54,12 @@ module Google
54
54
  # This indicates that the field may be set once in a request to create a
55
55
  # resource, but may not be changed thereafter.
56
56
  IMMUTABLE = 5
57
+
58
+ # Denotes that a (repeated) field is an unordered list.
59
+ # This indicates that the service may provide the elements of the list
60
+ # in any arbitrary order, rather than the order the user originally
61
+ # provided. Additionally, the list's order may or may not be stable.
62
+ UNORDERED_LIST = 6
57
63
  end
58
64
  end
59
65
  end
@@ -43,12 +43,12 @@ module Google
43
43
  #
44
44
  # The ResourceDescriptor Yaml config will look like:
45
45
  #
46
- # resources:
47
- # - type: "pubsub.googleapis.com/Topic"
48
- # name_descriptor:
49
- # - pattern: "projects/\\{project}/topics/\\{topic}"
50
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/\\{project}"
46
+ # resources:
47
+ # - type: "pubsub.googleapis.com/Topic"
48
+ # name_descriptor:
49
+ # - pattern: "projects/{project}/topics/{topic}"
50
+ # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
+ # parent_name_extractor: "projects/{project}"
52
52
  #
53
53
  # Sometimes, resources have multiple patterns, typically because they can
54
54
  # live under multiple parents.
@@ -183,15 +183,24 @@ module Google
183
183
  # }
184
184
  # @!attribute [rw] plural
185
185
  # @return [::String]
186
- # The plural name used in the resource name, such as 'projects' for
187
- # the name of 'projects/\\{project}'. It is the same concept of the `plural`
188
- # field in k8s CRD spec
186
+ # The plural name used in the resource name and permission names, such as
187
+ # 'projects' for the resource name of 'projects/\\{project}' and the permission
188
+ # name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same
189
+ # concept of the `plural` field in k8s CRD spec
189
190
  # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
191
+ #
192
+ # Note: The plural form is required even for singleton resources. See
193
+ # https://aip.dev/156
190
194
  # @!attribute [rw] singular
191
195
  # @return [::String]
192
196
  # The same concept of the `singular` field in k8s CRD spec
193
197
  # https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/
194
198
  # Such as "project" for the `resourcemanager.googleapis.com/Project` type.
199
+ # @!attribute [rw] style
200
+ # @return [::Array<::Google::Api::ResourceDescriptor::Style>]
201
+ # Style flag(s) for this resource.
202
+ # These indicate that a resource is expected to conform to a given
203
+ # style. See the specific style flags for additional information.
195
204
  class ResourceDescriptor
196
205
  include ::Google::Protobuf::MessageExts
197
206
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -211,6 +220,22 @@ module Google
211
220
  # that from being necessary once there are multiple patterns.)
212
221
  FUTURE_MULTI_PATTERN = 2
213
222
  end
223
+
224
+ # A flag representing a specific style that a resource claims to conform to.
225
+ module Style
226
+ # The unspecified value. Do not use.
227
+ STYLE_UNSPECIFIED = 0
228
+
229
+ # This resource is intended to be "declarative-friendly".
230
+ #
231
+ # Declarative-friendly resources must be more strictly consistent, and
232
+ # setting this to true communicates to tools that this resource should
233
+ # adhere to declarative-friendly expectations.
234
+ #
235
+ # Note: This is used by the API linter (linter.aip.dev) to enable
236
+ # additional checks.
237
+ DECLARATIVE_FRIENDLY = 1
238
+ end
214
239
  end
215
240
 
216
241
  # Defines a proto annotation that describes a string field that refers to
@@ -226,6 +251,17 @@ module Google
226
251
  # type: "pubsub.googleapis.com/Topic"
227
252
  # }];
228
253
  # }
254
+ #
255
+ # Occasionally, a field may reference an arbitrary resource. In this case,
256
+ # APIs use the special value * in their resource reference.
257
+ #
258
+ # Example:
259
+ #
260
+ # message GetIamPolicyRequest {
261
+ # string resource = 2 [(google.api.resource_reference) = {
262
+ # type: "*"
263
+ # }];
264
+ # }
229
265
  # @!attribute [rw] child_type
230
266
  # @return [::String]
231
267
  # The resource type of a child collection that the annotated field
@@ -234,11 +270,11 @@ module Google
234
270
  #
235
271
  # Example:
236
272
  #
237
- # message ListLogEntriesRequest {
238
- # string parent = 1 [(google.api.resource_reference) = {
239
- # child_type: "logging.googleapis.com/LogEntry"
240
- # };
241
- # }
273
+ # message ListLogEntriesRequest {
274
+ # string parent = 1 [(google.api.resource_reference) = {
275
+ # child_type: "logging.googleapis.com/LogEntry"
276
+ # };
277
+ # }
242
278
  class ResourceReference
243
279
  include ::Google::Protobuf::MessageExts
244
280
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -57,10 +57,13 @@ module Google
57
57
  # Example 4: Pack and unpack a message in Go
58
58
  #
59
59
  # foo := &pb.Foo{...}
60
- # any, err := ptypes.MarshalAny(foo)
60
+ # any, err := anypb.New(foo)
61
+ # if err != nil {
62
+ # ...
63
+ # }
61
64
  # ...
62
65
  # foo := &pb.Foo{}
63
- # if err := ptypes.UnmarshalAny(any, foo); err != nil {
66
+ # if err := any.UnmarshalTo(foo); err != nil {
64
67
  # ...
65
68
  # }
66
69
  #
@@ -70,7 +70,16 @@ module Google
70
70
  # .setNanos((int) ((millis % 1000) * 1000000)).build();
71
71
  #
72
72
  #
73
- # Example 5: Compute Timestamp from current time in Python.
73
+ # Example 5: Compute Timestamp from Java `Instant.now()`.
74
+ #
75
+ # Instant now = Instant.now();
76
+ #
77
+ # Timestamp timestamp =
78
+ # Timestamp.newBuilder().setSeconds(now.getEpochSecond())
79
+ # .setNanos(now.getNano()).build();
80
+ #
81
+ #
82
+ # Example 6: Compute Timestamp from current time in Python.
74
83
  #
75
84
  # timestamp = Timestamp()
76
85
  # timestamp.GetCurrentTime()
@@ -62,10 +62,9 @@ module Google
62
62
  end
63
63
 
64
64
  # A session in the Cloud Spanner API.
65
- # @!attribute [rw] name
65
+ # @!attribute [r] name
66
66
  # @return [::String]
67
- # The name of the session. This is always system-assigned; values provided
68
- # when creating a session are ignored.
67
+ # Output only. The name of the session. This is always system-assigned.
69
68
  # @!attribute [rw] labels
70
69
  # @return [::Google::Protobuf::Map{::String => ::String}]
71
70
  # The labels for the session.
@@ -77,10 +76,10 @@ module Google
77
76
  # * No more than 64 labels can be associated with a given session.
78
77
  #
79
78
  # See https://goo.gl/xmQnxf for more information on and examples of labels.
80
- # @!attribute [rw] create_time
79
+ # @!attribute [r] create_time
81
80
  # @return [::Google::Protobuf::Timestamp]
82
81
  # Output only. The timestamp when the session is created.
83
- # @!attribute [rw] approximate_last_use_time
82
+ # @!attribute [r] approximate_last_use_time
84
83
  # @return [::Google::Protobuf::Timestamp]
85
84
  # Output only. The approximate timestamp when the session is last used. It is
86
85
  # typically earlier than the actual last use time.
@@ -185,8 +184,9 @@ module Google
185
184
  # Parameter names and values that bind to placeholders in the SQL string.
186
185
  #
187
186
  # A parameter placeholder consists of the `@` character followed by the
188
- # parameter name (for example, `@firstName`). Parameter names can contain
189
- # letters, numbers, and underscores.
187
+ # parameter name (for example, `@firstName`). Parameter names must conform
188
+ # to the naming requirements of identifiers as specified at
189
+ # https://cloud.google.com/spanner/docs/lexical#identifiers.
190
190
  #
191
191
  # Parameters can appear anywhere that a literal value is expected. The same
192
192
  # parameter name can be used more than once, for example:
@@ -259,6 +259,9 @@ module Google
259
259
  # SPANNER_SYS.SUPPORTED_OPTIMIZER_VERSIONS. Executing a SQL statement
260
260
  # with an invalid optimizer version will fail with a syntax error
261
261
  # (`INVALID_ARGUMENT`) status.
262
+ # See
263
+ # https://cloud.google.com/spanner/docs/query-optimizer/manage-query-optimizer
264
+ # for more information on managing the query optimizer.
262
265
  #
263
266
  # The `optimizer_version` statement hint has precedence over this setting.
264
267
  class QueryOptions
@@ -650,6 +653,11 @@ module Google
650
653
  # The mutations to be executed when this transaction commits. All
651
654
  # mutations are applied atomically, in the order they appear in
652
655
  # this list.
656
+ # @!attribute [rw] return_commit_stats
657
+ # @return [::Boolean]
658
+ # If `true`, then statistics related to the transaction will be included in
659
+ # the {::Google::Cloud::Spanner::V1::CommitResponse#commit_stats CommitResponse}. Default value is
660
+ # `false`.
653
661
  class CommitRequest
654
662
  include ::Google::Protobuf::MessageExts
655
663
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -659,9 +667,29 @@ module Google
659
667
  # @!attribute [rw] commit_timestamp
660
668
  # @return [::Google::Protobuf::Timestamp]
661
669
  # The Cloud Spanner timestamp at which the transaction committed.
670
+ # @!attribute [rw] commit_stats
671
+ # @return [::Google::Cloud::Spanner::V1::CommitResponse::CommitStats]
672
+ # The statistics about this Commit. Not returned by default.
673
+ # For more information, see
674
+ # {::Google::Cloud::Spanner::V1::CommitRequest#return_commit_stats CommitRequest.return_commit_stats}.
662
675
  class CommitResponse
663
676
  include ::Google::Protobuf::MessageExts
664
677
  extend ::Google::Protobuf::MessageExts::ClassMethods
678
+
679
+ # Additional statistics about a commit.
680
+ # @!attribute [rw] mutation_count
681
+ # @return [::Integer]
682
+ # The total number of mutations for the transaction. Knowing the
683
+ # `mutation_count` value can help you maximize the number of mutations
684
+ # in a transaction and minimize the number of API round trips. You can
685
+ # also monitor this value to prevent transactions from exceeding the system
686
+ # [limit](http://cloud.google.com/spanner/quotas#limits_for_creating_reading_updating_and_deleting_data).
687
+ # If the number of mutations exceeds the limit, the server returns
688
+ # [INVALID_ARGUMENT](http://cloud.google.com/spanner/docs/reference/rest/v1/Code#ENUM_VALUES.INVALID_ARGUMENT).
689
+ class CommitStats
690
+ include ::Google::Protobuf::MessageExts
691
+ extend ::Google::Protobuf::MessageExts::ClassMethods
692
+ end
665
693
  end
666
694
 
667
695
  # The request for {::Google::Cloud::Spanner::V1::Spanner::Client#rollback Rollback}.
@@ -24,10 +24,11 @@ module Google
24
24
  # # Transactions
25
25
  #
26
26
  #
27
- # Each session can have at most one active transaction at a time. After the
28
- # active transaction is completed, the session can immediately be
29
- # re-used for the next transaction. It is not necessary to create a
30
- # new session for each transaction.
27
+ # Each session can have at most one active transaction at a time (note that
28
+ # standalone reads and queries use a transaction internally and do count
29
+ # towards the one transaction limit). After the active transaction is
30
+ # completed, the session can immediately be re-used for the next transaction.
31
+ # It is not necessary to create a new session for each transaction.
31
32
  #
32
33
  # # Transaction Modes
33
34
  #
@@ -59,7 +59,7 @@ module Google
59
59
  # SQL queries, it is the column alias (e.g., `"Word"` in the
60
60
  # query `"SELECT 'hello' AS Word"`), or the column name (e.g.,
61
61
  # `"ColName"` in the query `"SELECT ColName FROM Table"`). Some
62
- # columns might have an empty name (e.g., !"SELECT
62
+ # columns might have an empty name (e.g., `"SELECT
63
63
  # UPPER(ColName)"`). Note that a query result can contain
64
64
  # multiple fields with the same name.
65
65
  # @!attribute [rw] type
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-spanner-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-16 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -151,7 +151,9 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'
153
153
  description: Cloud Spanner is a managed, mission-critical, globally consistent and
154
- scalable relational database service.
154
+ scalable relational database service. Note that google-cloud-spanner-v1 is a version-specific
155
+ client library. For most uses, we recommend installing the main client library google-cloud-spanner
156
+ instead. See the readme for more details.
155
157
  email: googleapis-packages@google.com
156
158
  executables: []
157
159
  extensions: []
@@ -211,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
213
  - !ruby/object:Gem::Version
212
214
  version: '0'
213
215
  requirements: []
214
- rubygems_version: 3.1.3
216
+ rubygems_version: 3.2.6
215
217
  signing_key:
216
218
  specification_version: 4
217
219
  summary: API Client library for the Cloud Spanner V1 API