google-cloud-spanner 2.20.0 → 2.21.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: bb4b25a92a8c1064831ca356c5504c6114fde3efbda272ff4553dda86bf1a902
4
- data.tar.gz: 66c330a8e53e6e9ffac6735008586c5ad0027629e71f66f8401e2c58ea4394a9
3
+ metadata.gz: 3b4512d4772029fbc6c9ea89195d788ddd6cb0ecb06568764ada121e37b0afe5
4
+ data.tar.gz: acd1c491242e6c656eb8cff2ad1ec09749e4895a3badb828d58eb7db98a65760
5
5
  SHA512:
6
- metadata.gz: 6f296b9eb6930cad1c242402bc2dc8cb0ac47eaef1761acb598f35aaa63779d33192c0d92d5df852fe711ff7ad54c7b0f7695d2a0055b55a7dd05b80aa3d855d
7
- data.tar.gz: e3de3a8796cbcade1973cd2b4d3d5a632c6677173f24cd1ba0b9dfa7d8355e93122d9d0c0c3926d442271d057517adf9125cfb61e2f896faa54ec324d590aed4
6
+ metadata.gz: cd930852601a8ec5fb036662ad7fae03a99d5a0e9e7e566d689113d60bb62f90af4ba35da1856bdcee6a1ba147ad6f6e5a4701c37c0b59c0d371e43a25b93ec7
7
+ data.tar.gz: 7cabba248fda38947ebaf27f45b6bacf25ff14e770fcfabe76d6b66dc57c6e572aa82eb8b8bb1d4ed068036805e8f5cff56b5bc8cc553bd4921f75ac1e4a8b0d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.21.0 (2024-02-07)
4
+
5
+ #### Features
6
+
7
+ * support max_commit_delay for commit_options ([#85](https://github.com/googleapis/ruby-spanner/issues/85))
8
+
3
9
  ### 2.20.0 (2024-01-31)
4
10
 
5
11
  #### Features
@@ -1022,6 +1022,10 @@ module Google
1022
1022
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1023
1023
  # then statistics related to the transaction will be included in
1024
1024
  # {CommitResponse}. Default value is `false`
1025
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1026
+ # is willing to incur in order to improve throughput.
1027
+ # The commit delay must be at least 0ms and at most 500ms.
1028
+ # Default value is nil.
1025
1029
  # @param [Hash] request_options Common request options.
1026
1030
  #
1027
1031
  # * `:priority` (String) The relative priority for requests.
@@ -1141,6 +1145,10 @@ module Google
1141
1145
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1142
1146
  # then statistics related to the transaction will be included in
1143
1147
  # {CommitResponse}. Default value is `false`
1148
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1149
+ # is willing to incur in order to improve throughput.
1150
+ # The commit delay must be at least 0ms and at most 500ms.
1151
+ # Default value is nil.
1144
1152
  # @param [Hash] request_options Common request options.
1145
1153
  #
1146
1154
  # * `:priority` (String) The relative priority for requests.
@@ -1259,6 +1267,10 @@ module Google
1259
1267
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1260
1268
  # then statistics related to the transaction will be included in
1261
1269
  # {CommitResponse}. Default value is `false`
1270
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1271
+ # is willing to incur in order to improve throughput.
1272
+ # The commit delay must be at least 0ms and at most 500ms.
1273
+ # Default value is nil.
1262
1274
  # @param [Hash] request_options Common request options.
1263
1275
  #
1264
1276
  # * `:priority` (String) The relative priority for requests.
@@ -1378,6 +1390,10 @@ module Google
1378
1390
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1379
1391
  # then statistics related to the transaction will be included in
1380
1392
  # {CommitResponse}. Default value is `false`
1393
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1394
+ # is willing to incur in order to improve throughput.
1395
+ # The commit delay must be at least 0ms and at most 500ms.
1396
+ # Default value is nil.
1381
1397
  # @param [Hash] request_options Common request options.
1382
1398
  #
1383
1399
  # * `:priority` (String) The relative priority for requests.
@@ -1475,6 +1491,10 @@ module Google
1475
1491
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1476
1492
  # then statistics related to the transaction will be included in
1477
1493
  # {CommitResponse}. Default value is `false`
1494
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1495
+ # is willing to incur in order to improve throughput.
1496
+ # The commit delay must be at least 0ms and at most 500ms.
1497
+ # Default value is nil.
1478
1498
  # @param [Hash] request_options Common request options.
1479
1499
  #
1480
1500
  # * `:priority` (String) The relative priority for requests.
@@ -1579,6 +1599,10 @@ module Google
1579
1599
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1580
1600
  # then statistics related to the transaction will be included in
1581
1601
  # {CommitResponse}. Default value is `false`
1602
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1603
+ # is willing to incur in order to improve throughput.
1604
+ # The commit delay must be at least 0ms and at most 500ms.
1605
+ # Default value is nil.
1582
1606
  # @param [Hash] request_options Common request options.
1583
1607
  #
1584
1608
  # * `:priority` (String) The relative priority for requests.
@@ -1706,6 +1730,10 @@ module Google
1706
1730
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1707
1731
  # then statistics related to the transaction will be included in
1708
1732
  # {CommitResponse}. Default value is `false`
1733
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1734
+ # is willing to incur in order to improve throughput.
1735
+ # The commit delay must be at least 0ms and at most 500ms.
1736
+ # Default value is nil.
1709
1737
  # @param [Hash] request_options Common request options.
1710
1738
  #
1711
1739
  # * `:priority` (String) The relative priority for requests.
@@ -242,8 +242,9 @@ module Google
242
242
  Hash[row_to_pairs(row_types, row)]
243
243
  end
244
244
 
245
- def number_to_duration number
245
+ def number_to_duration number, millisecond: false
246
246
  return nil if number.nil?
247
+ number = number/1000.to_f if millisecond
247
248
 
248
249
  Google::Protobuf::Duration.new \
249
250
  seconds: number.to_i,
@@ -453,13 +453,26 @@ module Google
453
453
  request_options: request_options
454
454
  }
455
455
 
456
- if commit_options
457
- request[:return_commit_stats] = commit_options[:return_commit_stats]
458
- end
456
+ request = add_commit_options request, commit_options
459
457
 
460
458
  service.commit request, opts
461
459
  end
462
460
 
461
+ def add_commit_options request, commit_options
462
+ if commit_options
463
+ if commit_options.key? :return_commit_stats
464
+ request[:return_commit_stats] =
465
+ commit_options[:return_commit_stats]
466
+ end
467
+ if commit_options.key? :max_commit_delay
468
+ request[:max_commit_delay] =
469
+ Convert.number_to_duration(commit_options[:max_commit_delay],
470
+ millisecond: true)
471
+ end
472
+ end
473
+ request
474
+ end
475
+
463
476
  def rollback session_name, transaction_id, call_options: nil
464
477
  route_to_leader = LARHeaders.rollback
465
478
  opts = default_options session_name: session_name,
@@ -569,8 +569,11 @@ module Google
569
569
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
570
570
  # then statistics related to the transaction will be included in
571
571
  # {CommitResponse}. Default value is `false`
572
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
573
+ # is willing to incur in order to improve throughput.
574
+ # The commit delay must be at least 0ms and at most 500ms.
575
+ # Default value is nil.
572
576
  #
573
- # transaction. Default it is `false`.
574
577
  # @param [Hash] request_options Common request options.
575
578
  #
576
579
  # * `:request_tag` (String) A per-request tag which can be applied
@@ -686,7 +689,10 @@ module Google
686
689
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
687
690
  # then statistics related to the transaction will be included in
688
691
  # {CommitResponse}. Default value is `false`
689
- #
692
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
693
+ # is willing to incur in order to improve throughput.
694
+ # The commit delay must be at least 0ms and at most 500ms.
695
+ # Default value is nil.
690
696
  # @param [Hash] request_options Common request options.
691
697
  #
692
698
  # * `:request_tag` (String) A per-request tag which can be applied
@@ -794,7 +800,10 @@ module Google
794
800
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
795
801
  # then statistics related to the transaction will be included in
796
802
  # {CommitResponse}. Default value is `false`
797
- #
803
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
804
+ # is willing to incur in order to improve throughput.
805
+ # The commit delay must be at least 0ms and at most 500ms.
806
+ # Default value is nil.
798
807
  # @param [Hash] request_options Common request options.
799
808
  #
800
809
  # * `:request_tag` (String) A per-request tag which can be applied
@@ -901,7 +910,10 @@ module Google
901
910
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
902
911
  # then statistics related to the transaction will be included in
903
912
  # {CommitResponse}. Default value is `false`
904
- #
913
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
914
+ # is willing to incur in order to improve throughput.
915
+ # The commit delay must be at least 0ms and at most 500ms.
916
+ # Default value is nil.
905
917
  # @param [Hash] request_options Common request options.
906
918
  #
907
919
  # * `:request_tag` (String) A per-request tag which can be applied
@@ -1009,7 +1021,11 @@ module Google
1009
1021
  #
1010
1022
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1011
1023
  # then statistics related to the transaction will be included in
1012
- # {CommitResponse}. Default value is `false`.
1024
+ # {CommitResponse}. Default value is `false`
1025
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1026
+ # is willing to incur in order to improve throughput.
1027
+ # The commit delay must be at least 0ms and at most 500ms.
1028
+ # Default value is nil.
1013
1029
  #
1014
1030
  # @param [Hash] request_options Common request options.
1015
1031
  #
@@ -1099,7 +1115,10 @@ module Google
1099
1115
  # * `:return_commit_stats` (Boolean) A boolean value. If `true`,
1100
1116
  # then statistics related to the transaction will be included in
1101
1117
  # {CommitResponse}. Default value is `false`
1102
- #
1118
+ # * `:maxCommitDelay` (Numeric) The amount of latency in millisecond in this request
1119
+ # is willing to incur in order to improve throughput.
1120
+ # The commit delay must be at least 0ms and at most 500ms.
1121
+ # Default value is nil.
1103
1122
  # @param [Hash] request_options Common request options.
1104
1123
  #
1105
1124
  # * `:request_tag` (String) A per-request tag which can be applied
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.20.0".freeze
19
+ VERSION = "2.21.0".freeze
20
20
  end
21
21
  end
22
22
  end
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.20.0
4
+ version: 2.21.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: 2024-01-31 00:00:00.000000000 Z
12
+ date: 2024-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core