google-cloud-spanner 2.8.1 → 2.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -49
- data/OVERVIEW.md +69 -50
- data/lib/google/cloud/spanner/admin/database.rb +321 -0
- data/lib/google/cloud/spanner/admin/instance.rb +321 -0
- data/lib/google/cloud/spanner/backup/job/list.rb +7 -0
- data/lib/google/cloud/spanner/backup/job.rb +7 -0
- data/lib/google/cloud/spanner/backup/list.rb +7 -0
- data/lib/google/cloud/spanner/backup/restore/job.rb +7 -0
- data/lib/google/cloud/spanner/backup.rb +14 -0
- data/lib/google/cloud/spanner/client.rb +236 -34
- data/lib/google/cloud/spanner/convert.rb +22 -2
- data/lib/google/cloud/spanner/database/backup_info.rb +5 -0
- data/lib/google/cloud/spanner/database/job/list.rb +7 -0
- data/lib/google/cloud/spanner/database/job.rb +7 -0
- data/lib/google/cloud/spanner/database/list.rb +7 -0
- data/lib/google/cloud/spanner/database/restore_info.rb +5 -0
- data/lib/google/cloud/spanner/database.rb +13 -0
- data/lib/google/cloud/spanner/instance/config/list.rb +7 -0
- data/lib/google/cloud/spanner/instance/config.rb +7 -0
- data/lib/google/cloud/spanner/instance/job.rb +7 -0
- data/lib/google/cloud/spanner/instance/list.rb +7 -0
- data/lib/google/cloud/spanner/instance.rb +14 -0
- data/lib/google/cloud/spanner/project.rb +35 -0
- data/lib/google/cloud/spanner/service.rb +7 -2
- data/lib/google/cloud/spanner/session.rb +153 -0
- data/lib/google/cloud/spanner/transaction.rb +37 -1
- data/lib/google/cloud/spanner/version.rb +1 -1
- data/lib/google/cloud/spanner.rb +2 -0
- metadata +4 -2
@@ -12,6 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# DO NOT EDIT: Unless you're fixing a P0/P1 and/or a security issue. This class
|
16
|
+
# is frozen to all new features from `google-cloud-spanner/v2.11.0` onwards.
|
17
|
+
|
15
18
|
|
16
19
|
require "google/cloud/spanner/instance/config/list"
|
17
20
|
|
@@ -29,6 +32,10 @@ module Google
|
|
29
32
|
# See {Google::Cloud::Spanner::Project#instance_configs} and
|
30
33
|
# {Google::Cloud::Spanner::Project#instance_config}.
|
31
34
|
#
|
35
|
+
# @deprecated Use
|
36
|
+
# {Google::Cloud::Spanner::Admin::Instance::V1::InstanceConfig}
|
37
|
+
# instead.
|
38
|
+
#
|
32
39
|
# @example
|
33
40
|
# require "google/cloud/spanner"
|
34
41
|
#
|
@@ -12,6 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# DO NOT EDIT: Unless you're fixing a P0/P1 and/or a security issue. This class
|
16
|
+
# is frozen to all new features from `google-cloud-spanner/v2.11.0` onwards.
|
17
|
+
|
15
18
|
|
16
19
|
require "google/cloud/spanner/status"
|
17
20
|
|
@@ -31,6 +34,10 @@ module Google
|
|
31
34
|
# @see https://cloud.google.com/spanner/reference/rpc/google.longrunning#google.longrunning.Operation
|
32
35
|
# Long-running Operation
|
33
36
|
#
|
37
|
+
# @deprecated Use the long-running operation returned by
|
38
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#create_instance}
|
39
|
+
# instead.
|
40
|
+
#
|
34
41
|
# @example
|
35
42
|
# require "google/cloud/spanner"
|
36
43
|
#
|
@@ -12,6 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# DO NOT EDIT: Unless you're fixing a P0/P1 and/or a security issue. This class
|
16
|
+
# is frozen to all new features from `google-cloud-spanner/v2.11.0` onwards.
|
17
|
+
|
15
18
|
|
16
19
|
require "delegate"
|
17
20
|
|
@@ -22,6 +25,10 @@ module Google
|
|
22
25
|
##
|
23
26
|
# Instance::List is a special case Array with additional
|
24
27
|
# values.
|
28
|
+
#
|
29
|
+
# @deprecated Use the result of
|
30
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#list_instances}
|
31
|
+
# instead.
|
25
32
|
class List < DelegateClass(::Array)
|
26
33
|
##
|
27
34
|
# If not empty, indicates that there are more records that match
|
@@ -12,6 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# DO NOT EDIT: Unless you're fixing a P0/P1 and/or a security issue. This class
|
16
|
+
# is frozen to all new features from `google-cloud-spanner/v2.11.0` onwards.
|
17
|
+
|
15
18
|
|
16
19
|
require "google/cloud/spanner/instance/job"
|
17
20
|
require "google/cloud/spanner/instance/list"
|
@@ -25,6 +28,13 @@ module Google
|
|
25
28
|
##
|
26
29
|
# # Instance
|
27
30
|
#
|
31
|
+
# NOTE: From `google-cloud-spanner/v2.11.0` onwards, new features for
|
32
|
+
# mananging instances will only be available through the
|
33
|
+
# [google-cloud-spanner-admin-instance-v1](https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-spanner-admin-instance-v1)
|
34
|
+
# client. See the
|
35
|
+
# [README](https://github.com/googleapis/google-cloud-ruby/tree/master/google-cloud-spanner#google-cloud-spanner)
|
36
|
+
# for further details.
|
37
|
+
#
|
28
38
|
# Represents a Cloud Spanner instance. Instances are dedicated Cloud
|
29
39
|
# Spanner serving and storage resources to be used by Cloud Spanner
|
30
40
|
# databases. Instances offer isolation: problems with databases in one
|
@@ -38,6 +48,10 @@ module Google
|
|
38
48
|
# {Google::Cloud::Spanner::Project#instance}, and
|
39
49
|
# {Google::Cloud::Spanner::Project#create_instance}.
|
40
50
|
#
|
51
|
+
# @deprecated Use
|
52
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin}
|
53
|
+
# instead.
|
54
|
+
#
|
41
55
|
# @example
|
42
56
|
# require "google/cloud/spanner"
|
43
57
|
#
|
@@ -106,6 +106,10 @@ module Google
|
|
106
106
|
# @return [Array<Google::Cloud::Spanner::Instance>] The list of
|
107
107
|
# instances. (See {Google::Cloud::Spanner::Instance::List})
|
108
108
|
#
|
109
|
+
# @deprecated Use
|
110
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#list_instances}
|
111
|
+
# instead.
|
112
|
+
#
|
109
113
|
# @example
|
110
114
|
# require "google/cloud/spanner"
|
111
115
|
#
|
@@ -140,6 +144,10 @@ module Google
|
|
140
144
|
# @return [Google::Cloud::Spanner::Instance, nil] The instance, or `nil`
|
141
145
|
# if the instance does not exist.
|
142
146
|
#
|
147
|
+
# @deprecated Use
|
148
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#get_instance}
|
149
|
+
# instead.
|
150
|
+
#
|
143
151
|
# @example
|
144
152
|
# require "google/cloud/spanner"
|
145
153
|
#
|
@@ -200,6 +208,10 @@ module Google
|
|
200
208
|
# asynchronous processing of an instance create operation.
|
201
209
|
# @raise [ArgumentError] if both processing_units or nodes are specified.
|
202
210
|
#
|
211
|
+
# @deprecated Use
|
212
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#create_instance}
|
213
|
+
# instead.
|
214
|
+
#
|
203
215
|
# @example
|
204
216
|
# require "google/cloud/spanner"
|
205
217
|
#
|
@@ -266,6 +278,10 @@ module Google
|
|
266
278
|
# instance configurations. (See
|
267
279
|
# {Google::Cloud::Spanner::Instance::Config::List})
|
268
280
|
#
|
281
|
+
# @deprecated Use
|
282
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#list_instance_configs}
|
283
|
+
# instead.
|
284
|
+
#
|
269
285
|
# @example
|
270
286
|
# require "google/cloud/spanner"
|
271
287
|
#
|
@@ -303,6 +319,10 @@ module Google
|
|
303
319
|
# configuration, or `nil` if the instance configuration does not
|
304
320
|
# exist.
|
305
321
|
#
|
322
|
+
# @deprecated Use
|
323
|
+
# {Google::Cloud::Spanner::Admin::Instance#instance_admin Client#get_instance_config}
|
324
|
+
# instead.
|
325
|
+
#
|
306
326
|
# @example
|
307
327
|
# require "google/cloud/spanner"
|
308
328
|
#
|
@@ -335,6 +355,10 @@ module Google
|
|
335
355
|
# @return [Array<Google::Cloud::Spanner::Database>] The list of
|
336
356
|
# databases. (See {Google::Cloud::Spanner::Database::List})
|
337
357
|
#
|
358
|
+
# @deprecated Use
|
359
|
+
# {Google::Cloud::Spanner::Admin::Database#database_admin Client#list_databases}
|
360
|
+
# instead.
|
361
|
+
#
|
338
362
|
# @example
|
339
363
|
# require "google/cloud/spanner"
|
340
364
|
#
|
@@ -370,6 +394,10 @@ module Google
|
|
370
394
|
# @return [Google::Cloud::Spanner::Database, nil] The database, or `nil`
|
371
395
|
# if the database does not exist.
|
372
396
|
#
|
397
|
+
# @deprecated Use
|
398
|
+
# {Google::Cloud::Spanner::Admin::Database#database_admin Client#get_database}
|
399
|
+
# instead.
|
400
|
+
#
|
373
401
|
# @example
|
374
402
|
# require "google/cloud/spanner"
|
375
403
|
#
|
@@ -417,6 +445,10 @@ module Google
|
|
417
445
|
# @return [Database::Job] The job representing the long-running,
|
418
446
|
# asynchronous processing of a database create operation.
|
419
447
|
#
|
448
|
+
# @deprecated Use
|
449
|
+
# {Google::Cloud::Spanner::Admin::Database#database_admin Client#create_database}
|
450
|
+
# instead.
|
451
|
+
#
|
420
452
|
# @example
|
421
453
|
# require "google/cloud/spanner"
|
422
454
|
#
|
@@ -629,6 +661,9 @@ module Google
|
|
629
661
|
raise "Must have active connection to service" unless service
|
630
662
|
end
|
631
663
|
|
664
|
+
# @deprecated Use
|
665
|
+
# {Google::Cloud::Spanner::Admin::Database#database_admin Client#database_path}
|
666
|
+
# instead.
|
632
667
|
def database_path instance_id, database_id
|
633
668
|
Admin::Database::V1::DatabaseAdminClient.database_path(
|
634
669
|
project, instance_id, database_id
|
@@ -441,13 +441,18 @@ module Google
|
|
441
441
|
service.rollback request, opts
|
442
442
|
end
|
443
443
|
|
444
|
-
def begin_transaction session_name,
|
444
|
+
def begin_transaction session_name, request_options: nil,
|
445
|
+
call_options: nil
|
445
446
|
tx_opts = V1::TransactionOptions.new(
|
446
447
|
read_write: V1::TransactionOptions::ReadWrite.new
|
447
448
|
)
|
448
449
|
opts = default_options session_name: session_name,
|
449
450
|
call_options: call_options
|
450
|
-
request = {
|
451
|
+
request = {
|
452
|
+
session: session_name,
|
453
|
+
options: tx_opts,
|
454
|
+
request_options: request_options
|
455
|
+
}
|
451
456
|
service.begin_transaction request, opts
|
452
457
|
end
|
453
458
|
|
@@ -167,6 +167,23 @@ module Google
|
|
167
167
|
# available optimizer version.
|
168
168
|
# * `:optimizer_statistics_package` (String) Statistics package to
|
169
169
|
# use. Empty to use the database default.
|
170
|
+
# @param [Hash] request_options Common request options.
|
171
|
+
#
|
172
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
173
|
+
# to queries or reads, used for statistics collection. Both
|
174
|
+
# request_tag and transaction_tag can be specified for a read or
|
175
|
+
# query that belongs to a transaction. This field is ignored for
|
176
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
177
|
+
# `request_tag` must be a valid identifier of the form:
|
178
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
179
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
180
|
+
# about this transaction. Both request_tag and transaction_tag can
|
181
|
+
# be specified for a read or query that belongs to a transaction.
|
182
|
+
# The value of transaction_tag should be the same for all requests
|
183
|
+
# belonging to the same transaction. If this request doesn't belong
|
184
|
+
# to any transaction, transaction_tag will be ignored.
|
185
|
+
# `transaction_tag` must be a valid identifier of the format:
|
186
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
170
187
|
# @param [Hash] call_options A hash of values to specify the custom
|
171
188
|
# call options, e.g., timeout, retries, etc. Call options are
|
172
189
|
# optional. The following settings can be provided:
|
@@ -349,6 +366,23 @@ module Google
|
|
349
366
|
# transactions.
|
350
367
|
# @param [Integer] seqno A per-transaction sequence number used to
|
351
368
|
# identify this request.
|
369
|
+
# @param [Hash] request_options Common request options.
|
370
|
+
#
|
371
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
372
|
+
# to queries or reads, used for statistics collection. Both
|
373
|
+
# request_tag and transaction_tag can be specified for a read or
|
374
|
+
# query that belongs to a transaction. This field is ignored for
|
375
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
376
|
+
# `request_tag` must be a valid identifier of the form:
|
377
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
378
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
379
|
+
# about this transaction. Both request_tag and transaction_tag can
|
380
|
+
# be specified for a read or query that belongs to a transaction.
|
381
|
+
# The value of transaction_tag should be the same for all requests
|
382
|
+
# belonging to the same transaction. If this request doesn't belong
|
383
|
+
# to any transaction, transaction_tag will be ignored.
|
384
|
+
# `transaction_tag` must be a valid identifier of the format:
|
385
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
352
386
|
# @param [Hash] call_options A hash of values to specify the custom
|
353
387
|
# call options, e.g., timeout, retries, etc. Call options are
|
354
388
|
# optional. The following settings can be provided:
|
@@ -413,6 +447,23 @@ module Google
|
|
413
447
|
# @param [Google::Cloud::Spanner::V1::TransactionSelector] transaction The
|
414
448
|
# transaction selector value to send. Only used for single-use
|
415
449
|
# transactions.
|
450
|
+
# @param [Hash] request_options Common request options.
|
451
|
+
#
|
452
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
453
|
+
# to queries or reads, used for statistics collection. Both
|
454
|
+
# request_tag and transaction_tag can be specified for a read or
|
455
|
+
# query that belongs to a transaction. This field is ignored for
|
456
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
457
|
+
# `request_tag` must be a valid identifier of the form:
|
458
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
459
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
460
|
+
# about this transaction. Both request_tag and transaction_tag can
|
461
|
+
# be specified for a read or query that belongs to a transaction.
|
462
|
+
# The value of transaction_tag should be the same for all requests
|
463
|
+
# belonging to the same transaction. If this request doesn't belong
|
464
|
+
# to any transaction, transaction_tag will be ignored.
|
465
|
+
# `transaction_tag` must be a valid identifier of the format:
|
466
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
416
467
|
# @param [Hash] call_options A hash of values to specify the custom
|
417
468
|
# call options, e.g., timeout, retries, etc. Call options are
|
418
469
|
# optional. The following settings can be provided:
|
@@ -506,6 +557,23 @@ module Google
|
|
506
557
|
# {CommitResponse}. Default value is `false`
|
507
558
|
#
|
508
559
|
# transaction. Default it is `false`.
|
560
|
+
# @param [Hash] request_options Common request options.
|
561
|
+
#
|
562
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
563
|
+
# to queries or reads, used for statistics collection. Both
|
564
|
+
# request_tag and transaction_tag can be specified for a read or
|
565
|
+
# query that belongs to a transaction. This field is ignored for
|
566
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
567
|
+
# `request_tag` must be a valid identifier of the form:
|
568
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
569
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
570
|
+
# about this transaction. Both request_tag and transaction_tag can
|
571
|
+
# be specified for a read or query that belongs to a transaction.
|
572
|
+
# The value of transaction_tag should be the same for all requests
|
573
|
+
# belonging to the same transaction. If this request doesn't belong
|
574
|
+
# to any transaction, transaction_tag will be ignored.
|
575
|
+
# `transaction_tag` must be a valid identifier of the format:
|
576
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
509
577
|
# @param [Hash] call_options A hash of values to specify the custom
|
510
578
|
# call options, e.g., timeout, retries, etc. Call options are
|
511
579
|
# optional. The following settings can be provided:
|
@@ -605,6 +673,23 @@ module Google
|
|
605
673
|
# then statistics related to the transaction will be included in
|
606
674
|
# {CommitResponse}. Default value is `false`
|
607
675
|
#
|
676
|
+
# @param [Hash] request_options Common request options.
|
677
|
+
#
|
678
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
679
|
+
# to queries or reads, used for statistics collection. Both
|
680
|
+
# request_tag and transaction_tag can be specified for a read or
|
681
|
+
# query that belongs to a transaction. This field is ignored for
|
682
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
683
|
+
# `request_tag` must be a valid identifier of the form:
|
684
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
685
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
686
|
+
# about this transaction. Both request_tag and transaction_tag can
|
687
|
+
# be specified for a read or query that belongs to a transaction.
|
688
|
+
# The value of transaction_tag should be the same for all requests
|
689
|
+
# belonging to the same transaction. If this request doesn't belong
|
690
|
+
# to any transaction, transaction_tag will be ignored.
|
691
|
+
# `transaction_tag` must be a valid identifier of the format:
|
692
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
608
693
|
# @param [Hash] call_options A hash of values to specify the custom
|
609
694
|
# call options, e.g., timeout, retries, etc. Call options are
|
610
695
|
# optional. The following settings can be provided:
|
@@ -696,6 +781,23 @@ module Google
|
|
696
781
|
# then statistics related to the transaction will be included in
|
697
782
|
# {CommitResponse}. Default value is `false`
|
698
783
|
#
|
784
|
+
# @param [Hash] request_options Common request options.
|
785
|
+
#
|
786
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
787
|
+
# to queries or reads, used for statistics collection. Both
|
788
|
+
# request_tag and transaction_tag can be specified for a read or
|
789
|
+
# query that belongs to a transaction. This field is ignored for
|
790
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
791
|
+
# `request_tag` must be a valid identifier of the form:
|
792
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
793
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
794
|
+
# about this transaction. Both request_tag and transaction_tag can
|
795
|
+
# be specified for a read or query that belongs to a transaction.
|
796
|
+
# The value of transaction_tag should be the same for all requests
|
797
|
+
# belonging to the same transaction. If this request doesn't belong
|
798
|
+
# to any transaction, transaction_tag will be ignored.
|
799
|
+
# `transaction_tag` must be a valid identifier of the format:
|
800
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
699
801
|
# @param [Hash] call_options A hash of values to specify the custom
|
700
802
|
# call options, e.g., timeout, retries, etc. Call options are
|
701
803
|
# optional. The following settings can be provided:
|
@@ -786,6 +888,23 @@ module Google
|
|
786
888
|
# then statistics related to the transaction will be included in
|
787
889
|
# {CommitResponse}. Default value is `false`
|
788
890
|
#
|
891
|
+
# @param [Hash] request_options Common request options.
|
892
|
+
#
|
893
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
894
|
+
# to queries or reads, used for statistics collection. Both
|
895
|
+
# request_tag and transaction_tag can be specified for a read or
|
896
|
+
# query that belongs to a transaction. This field is ignored for
|
897
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
898
|
+
# `request_tag` must be a valid identifier of the form:
|
899
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
900
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
901
|
+
# about this transaction. Both request_tag and transaction_tag can
|
902
|
+
# be specified for a read or query that belongs to a transaction.
|
903
|
+
# The value of transaction_tag should be the same for all requests
|
904
|
+
# belonging to the same transaction. If this request doesn't belong
|
905
|
+
# to any transaction, transaction_tag will be ignored.
|
906
|
+
# `transaction_tag` must be a valid identifier of the format:
|
907
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
789
908
|
# @param [Hash] call_options A hash of values to specify the custom
|
790
909
|
# call options, e.g., timeout, retries, etc. Call options are
|
791
910
|
# optional. The following settings can be provided:
|
@@ -878,6 +997,23 @@ module Google
|
|
878
997
|
# then statistics related to the transaction will be included in
|
879
998
|
# {CommitResponse}. Default value is `false`.
|
880
999
|
#
|
1000
|
+
# @param [Hash] request_options Common request options.
|
1001
|
+
#
|
1002
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
1003
|
+
# to queries or reads, used for statistics collection. Both
|
1004
|
+
# request_tag and transaction_tag can be specified for a read or
|
1005
|
+
# query that belongs to a transaction. This field is ignored for
|
1006
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
1007
|
+
# `request_tag` must be a valid identifier of the form:
|
1008
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
1009
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
1010
|
+
# about this transaction. Both request_tag and transaction_tag can
|
1011
|
+
# be specified for a read or query that belongs to a transaction.
|
1012
|
+
# The value of transaction_tag should be the same for all requests
|
1013
|
+
# belonging to the same transaction. If this request doesn't belong
|
1014
|
+
# to any transaction, transaction_tag will be ignored.
|
1015
|
+
# `transaction_tag` must be a valid identifier of the format:
|
1016
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
881
1017
|
# @param [Hash] call_options A hash of values to specify the custom
|
882
1018
|
# call options, e.g., timeout, retries, etc. Call options are
|
883
1019
|
# optional. The following settings can be provided:
|
@@ -950,6 +1086,23 @@ module Google
|
|
950
1086
|
# then statistics related to the transaction will be included in
|
951
1087
|
# {CommitResponse}. Default value is `false`
|
952
1088
|
#
|
1089
|
+
# @param [Hash] request_options Common request options.
|
1090
|
+
#
|
1091
|
+
# * `:request_tag` (String) A per-request tag which can be applied
|
1092
|
+
# to queries or reads, used for statistics collection. Both
|
1093
|
+
# request_tag and transaction_tag can be specified for a read or
|
1094
|
+
# query that belongs to a transaction. This field is ignored for
|
1095
|
+
# requests where it's not applicable (e.g. CommitRequest).
|
1096
|
+
# `request_tag` must be a valid identifier of the form:
|
1097
|
+
# `[a-zA-Z][a-zA-Z0-9_\-]` between 2 and 64 characters in length.
|
1098
|
+
# * `:transaction_tag` (String) A tag used for statistics collection
|
1099
|
+
# about this transaction. Both request_tag and transaction_tag can
|
1100
|
+
# be specified for a read or query that belongs to a transaction.
|
1101
|
+
# The value of transaction_tag should be the same for all requests
|
1102
|
+
# belonging to the same transaction. If this request doesn't belong
|
1103
|
+
# to any transaction, transaction_tag will be ignored.
|
1104
|
+
# `transaction_tag` must be a valid identifier of the format:
|
1105
|
+
# [a-zA-Z][a-zA-Z0-9_\-]{0,49}
|
953
1106
|
# @param [Hash] call_options A hash of values to specify the custom
|
954
1107
|
# call options, e.g., timeout, retries, etc. Call options are
|
955
1108
|
# optional. The following settings can be provided:
|
@@ -77,6 +77,9 @@ module Google
|
|
77
77
|
# @private The Session object.
|
78
78
|
attr_accessor :session
|
79
79
|
|
80
|
+
# @private Transaction tag for statistics collection.
|
81
|
+
attr_accessor :transaction_tag
|
82
|
+
|
80
83
|
def initialize
|
81
84
|
@commit = Commit.new
|
82
85
|
@seqno = 0
|
@@ -167,6 +170,10 @@ module Google
|
|
167
170
|
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
168
171
|
# `:PRIORITY_HIGH`. If priority not set then default is
|
169
172
|
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
173
|
+
# * `:tag` (String) A per-request tag which can be applied to
|
174
|
+
# queries or reads, used for statistics collection. Tag must be a
|
175
|
+
# valid identifier of the form: `[a-zA-Z][a-zA-Z0-9_\-]` between 2
|
176
|
+
# and 64 characters in length.
|
170
177
|
# @param [Hash] call_options A hash of values to specify the custom
|
171
178
|
# call options, e.g., timeout, retries, etc. Call options are
|
172
179
|
# optional. The following settings can be provided:
|
@@ -333,6 +340,7 @@ module Google
|
|
333
340
|
@seqno += 1
|
334
341
|
|
335
342
|
params, types = Convert.to_input_params_and_types params, types
|
343
|
+
request_options = build_request_options request_options
|
336
344
|
session.execute_query sql, params: params, types: types,
|
337
345
|
transaction: tx_selector, seqno: @seqno,
|
338
346
|
query_options: query_options,
|
@@ -419,6 +427,10 @@ module Google
|
|
419
427
|
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
420
428
|
# `:PRIORITY_HIGH`. If priority not set then default is
|
421
429
|
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
430
|
+
# * `:tag` (String) A per-request tag which can be applied to
|
431
|
+
# queries or reads, used for statistics collection. Tag must be a
|
432
|
+
# valid identifier of the form: `[a-zA-Z][a-zA-Z0-9_\-]` between 2
|
433
|
+
# and 64 characters in length.
|
422
434
|
# @param [Hash] call_options A hash of values to specify the custom
|
423
435
|
# call options, e.g., timeout, retries, etc. Call options are
|
424
436
|
# optional. The following settings can be provided:
|
@@ -525,6 +537,10 @@ module Google
|
|
525
537
|
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
526
538
|
# `:PRIORITY_HIGH`. If priority not set then default is
|
527
539
|
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
540
|
+
# * `:tag` (String) A per-request tag which can be applied to
|
541
|
+
# queries or reads, used for statistics collection. Tag must be a
|
542
|
+
# valid identifier of the form: `[a-zA-Z][a-zA-Z0-9_\-]` between 2
|
543
|
+
# and 64 characters in length.
|
528
544
|
# @param [Hash] call_options A hash of values to specify the custom
|
529
545
|
# call options, e.g., timeout, retries, etc. Call options are
|
530
546
|
# optional. The following settings can be provided:
|
@@ -597,6 +613,8 @@ module Google
|
|
597
613
|
def batch_update request_options: nil, call_options: nil, &block
|
598
614
|
ensure_session!
|
599
615
|
@seqno += 1
|
616
|
+
|
617
|
+
request_options = build_request_options request_options
|
600
618
|
session.batch_update tx_selector, @seqno,
|
601
619
|
request_options: request_options,
|
602
620
|
call_options: call_options, &block
|
@@ -626,6 +644,10 @@ module Google
|
|
626
644
|
# Valid values are `:PRIORITY_LOW`, `:PRIORITY_MEDIUM`,
|
627
645
|
# `:PRIORITY_HIGH`. If priority not set then default is
|
628
646
|
# `PRIORITY_UNSPECIFIED` is equivalent to `:PRIORITY_HIGH`.
|
647
|
+
# * `:tag` (String) A per-request tag which can be applied to
|
648
|
+
# queries or reads, used for statistics collection. Tag must be a
|
649
|
+
# valid identifier of the form: `[a-zA-Z][a-zA-Z0-9_\-]` between 2
|
650
|
+
# and 64 characters in length.
|
629
651
|
# @param [Hash] call_options A hash of values to specify the custom
|
630
652
|
# call options, e.g., timeout, retries, etc. Call options are
|
631
653
|
# optional. The following settings can be provided:
|
@@ -663,7 +685,7 @@ module Google
|
|
663
685
|
|
664
686
|
columns = Array(columns).map(&:to_s)
|
665
687
|
keys = Convert.to_key_set keys
|
666
|
-
|
688
|
+
request_options = build_request_options request_options
|
667
689
|
session.read table, columns, keys: keys, index: index, limit: limit,
|
668
690
|
transaction: tx_selector,
|
669
691
|
request_options: request_options,
|
@@ -1097,6 +1119,20 @@ module Google
|
|
1097
1119
|
V1::TransactionSelector.new id: transaction_id
|
1098
1120
|
end
|
1099
1121
|
|
1122
|
+
##
|
1123
|
+
# @private Build request options. If transaction tag is set
|
1124
|
+
# then add into request options.
|
1125
|
+
def build_request_options options
|
1126
|
+
options = Convert.to_request_options options, tag_type: :request_tag
|
1127
|
+
|
1128
|
+
if transaction_tag
|
1129
|
+
options ||= {}
|
1130
|
+
options[:transaction_tag] = transaction_tag
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
options
|
1134
|
+
end
|
1135
|
+
|
1100
1136
|
##
|
1101
1137
|
# @private Raise an error unless an active connection to the service is
|
1102
1138
|
# available.
|
data/lib/google/cloud/spanner.rb
CHANGED
@@ -143,6 +143,8 @@ module Google
|
|
143
143
|
# parameter `keyfile` is considered deprecated, but may also be used.)
|
144
144
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
145
145
|
# the set of resources and operations that the connection can access.
|
146
|
+
# * `quota_project` - (String) The project ID for a project that can be
|
147
|
+
# used by client libraries for quota and billing purposes.
|
146
148
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
147
149
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
148
150
|
# to use the default endpoint.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-spanner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Moore
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -269,7 +269,9 @@ files:
|
|
269
269
|
- TROUBLESHOOTING.md
|
270
270
|
- lib/google-cloud-spanner.rb
|
271
271
|
- lib/google/cloud/spanner.rb
|
272
|
+
- lib/google/cloud/spanner/admin/database.rb
|
272
273
|
- lib/google/cloud/spanner/admin/database/credentials.rb
|
274
|
+
- lib/google/cloud/spanner/admin/instance.rb
|
273
275
|
- lib/google/cloud/spanner/admin/instance/credentials.rb
|
274
276
|
- lib/google/cloud/spanner/backup.rb
|
275
277
|
- lib/google/cloud/spanner/backup/job.rb
|