google-cloud-spanner 2.4.0 → 2.5.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: f6bfbaef2aa9726c4f6546f22d9ad3da14cdd74f1d5704f0af88aaa197285af7
4
- data.tar.gz: b21b4f7ce50132358a00b6d4f2723e2299b449edf7cdb50652263f3dc1e7a417
3
+ metadata.gz: 9768d839e58d7697a3ec4d57f924c6dd251bf59b1bb531ca2fbcf14da1b6120d
4
+ data.tar.gz: 2fd33ab3bfddeaed840fd815d057e3ddb81bf3a4b746b88f20dcc72ecca46e44
5
5
  SHA512:
6
- metadata.gz: 2b26a10becd37ce0527996754eb16f368635269144f584d5cf1c25f17285d280f847e58ca49ccd942fb7adff59779e2a63f5c90987f548786759a5b65b337e49
7
- data.tar.gz: 4e46cc9fddeb100349f410c08ef2b7d21fe0f43f6368e5ee3d2e6231c4da4ed7eb781fafb795408fbfadaca29dbcefc2b55ef290ccd39eab74d953959f59838b
6
+ metadata.gz: ba9f01ea9fc094a4ece357bacddc46cf235704f242eea88393de8ea5b1e5ae56b1f5260ad26e999ad53047d4a4c7f6d855612ea6de139e80ae7d60ec6b305fdf
7
+ data.tar.gz: fb498abaae70d4b8c56736b8267f87ae3637ddfe6b3aad675ad35c2faa1d4681a3a91be98ce6604454b185557a11aaf5a8294b0e007a849ff08ff19cad3088ae
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Release History
2
2
 
3
+ ### 2.5.0 / 2021-03-10
4
+
5
+ #### Features
6
+
7
+ * Drop support for Ruby 2.4 and add support for Ruby 3.0
8
+
3
9
  ### 2.4.0 / 2021-02-18
4
10
 
5
11
  #### Features
data/CONTRIBUTING.md CHANGED
@@ -24,7 +24,7 @@ be able to accept your pull requests.
24
24
  In order to use the google-cloud-spanner console and run the project's tests,
25
25
  there is a small amount of setup:
26
26
 
27
- 1. Install Ruby. google-cloud-spanner requires Ruby 2.4+. You may choose to
27
+ 1. Install Ruby. google-cloud-spanner requires Ruby 2.5+. You may choose to
28
28
  manage your Ruby and gem installations with [RVM](https://rvm.io/),
29
29
  [rbenv](https://github.com/rbenv/rbenv), or
30
30
  [chruby](https://github.com/postmodern/chruby).
data/LOGGING.md CHANGED
@@ -3,7 +3,7 @@
3
3
  To enable logging for this library, set the logger for the underlying
4
4
  [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library. The logger
5
5
  that you set may be a Ruby stdlib
6
- [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as
6
+ [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as
7
7
  shown below, or a
8
8
  [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
9
9
  that will write logs to [Stackdriver
@@ -155,9 +155,9 @@ module Google
155
155
  @grpc.expire_time = Convert.time_to_timestamp time
156
156
  update_mask = Google::Protobuf::FieldMask.new paths: ["expire_time"]
157
157
  @grpc = service.update_backup @grpc, update_mask
158
- rescue Google::Cloud::Error => error
158
+ rescue Google::Cloud::Error => e
159
159
  @grpc.expire_time = expire_time_was
160
- raise error
160
+ raise e
161
161
  end
162
162
 
163
163
  ##
@@ -39,7 +39,7 @@ module Google
39
39
  #
40
40
  # database = spanner.database "my-instance", "my-database"
41
41
  # expire_time = Time.now + 36000
42
- # job = database.create_backup "my-backup", expire_time: expire_time
42
+ # job = database.create_backup "my-backup", expire_time
43
43
  #
44
44
  # job.done? #=> false
45
45
  # job.reload! # API call
@@ -80,7 +80,7 @@ module Google
80
80
  #
81
81
  # database = spanner.database "my-instance", "my-database"
82
82
  # expire_time = Time.now + 36000
83
- # job = database.create_backup "my-backup", expire_time: expire_time
83
+ # job = database.create_backup "my-backup", expire_time
84
84
  #
85
85
  # job.done? #=> false
86
86
  # job.reload!
@@ -105,7 +105,7 @@ module Google
105
105
  #
106
106
  # database = spanner.database "my-instance", "my-database"
107
107
  # expire_time = Time.now + 36000
108
- # job = database.create_backup "my-backup", expire_time: expire_time
108
+ # job = database.create_backup "my-backup", expire_time
109
109
  #
110
110
  # job.done? #=> false
111
111
  #
@@ -125,7 +125,7 @@ module Google
125
125
  #
126
126
  # database = spanner.database "my-instance", "my-database"
127
127
  # expire_time = Time.now + 36000
128
- # job = database.create_backup "my-backup", expire_time: expire_time
128
+ # job = database.create_backup "my-backup", expire_time
129
129
  #
130
130
  # job.error? #=> false
131
131
  #
@@ -147,7 +147,7 @@ module Google
147
147
  #
148
148
  # database = spanner.database "my-instance", "my-database"
149
149
  # expire_time = Time.now + 36000
150
- # job = database.create_backup "my-backup", expire_time: expire_time
150
+ # job = database.create_backup "my-backup", expire_time
151
151
  #
152
152
  # job.error? # true
153
153
  #
@@ -172,7 +172,7 @@ module Google
172
172
  #
173
173
  # database = spanner.database "my-instance", "my-database"
174
174
  # expire_time = Time.now + 36000
175
- # job = database.create_backup "my-backup", expire_time: expire_time
175
+ # job = database.create_backup "my-backup", expire_time
176
176
  #
177
177
  # job.done? #=> false
178
178
  # job.reload! # API call
@@ -195,7 +195,7 @@ module Google
195
195
  #
196
196
  # database = spanner.database "my-instance", "my-database"
197
197
  # expire_time = Time.now + 36000
198
- # job = database.create_backup "my-backup", expire_time: expire_time
198
+ # job = database.create_backup "my-backup", expire_time
199
199
  #
200
200
  # job.done? #=> false
201
201
  # job.wait_until_done!
@@ -215,7 +215,7 @@ module Google
215
215
  #
216
216
  # database = spanner.database "my-instance", "my-database"
217
217
  # expire_time = Time.now + 36000
218
- # job = database.create_backup "my-backup", expire_time: expire_time
218
+ # job = database.create_backup "my-backup", expire_time
219
219
  #
220
220
  # job.done? #=> false
221
221
  # job.cancel
@@ -130,12 +130,12 @@ module Google
130
130
  # job.backup.backup_id
131
131
  # end
132
132
  #
133
- def all
133
+ def all &block
134
134
  return enum_for :all unless block_given?
135
135
 
136
136
  results = self
137
137
  loop do
138
- results.each { |r| yield r }
138
+ results.each(&block)
139
139
  break unless next?
140
140
  grpc.next_page
141
141
  results = self.class.from_grpc grpc, service
@@ -128,12 +128,12 @@ module Google
128
128
  # backup.backup_id
129
129
  # end
130
130
  #
131
- def all
131
+ def all &block
132
132
  return enum_for :all unless block_given?
133
133
 
134
134
  results = self
135
135
  loop do
136
- results.each { |r| yield r }
136
+ results.each(&block)
137
137
  break unless next?
138
138
  grpc.next_page
139
139
  results = self.class.from_grpc grpc, service
@@ -373,9 +373,9 @@ module Google
373
373
 
374
374
  opts = { call_options: call_options }
375
375
  if partition.execute?
376
- execute_partition_query partition, opts
376
+ execute_partition_query partition, **opts
377
377
  elsif partition.read?
378
- execute_partition_read partition, opts
378
+ execute_partition_read partition, **opts
379
379
  end
380
380
  end
381
381
 
@@ -142,7 +142,9 @@ module Google
142
142
 
143
143
  # @private
144
144
  class Statement
145
- attr_reader :sql, :params, :types
145
+ attr_reader :sql
146
+ attr_reader :params
147
+ attr_reader :types
146
148
 
147
149
  def initialize sql, params: nil, types: nil
148
150
  @sql = sql
@@ -59,7 +59,7 @@ module Google
59
59
  @instance_id = instance_id
60
60
  @database_id = database_id
61
61
  @session_labels = session_labels
62
- @pool = Pool.new self, pool_opts
62
+ @pool = Pool.new self, **pool_opts
63
63
  @query_options = query_options
64
64
  end
65
65
 
@@ -1248,7 +1248,6 @@ module Google
1248
1248
  end
1249
1249
 
1250
1250
  # rubocop:disable Metrics/AbcSize
1251
- # rubocop:disable Metrics/BlockLength
1252
1251
  # rubocop:disable Metrics/MethodLength
1253
1252
 
1254
1253
  ##
@@ -1362,44 +1361,41 @@ module Google
1362
1361
  start_time = current_time
1363
1362
 
1364
1363
  @pool.with_transaction do |tx|
1365
- begin
1366
- Thread.current[:transaction_id] = tx.transaction_id
1367
- yield tx
1368
- commit_resp = @project.service.commit \
1369
- tx.session.path, tx.mutations,
1370
- transaction_id: tx.transaction_id,
1371
- commit_options: commit_options,
1372
- call_options: call_options
1373
- resp = CommitResponse.from_grpc commit_resp
1374
- commit_options ? resp : resp.timestamp
1375
- rescue GRPC::Aborted, Google::Cloud::AbortedError => err
1376
- # Re-raise if deadline has passed
1377
- if current_time - start_time > deadline
1378
- if err.is_a? GRPC::BadStatus
1379
- err = Google::Cloud::Error.from_error err
1380
- end
1381
- raise err
1364
+ Thread.current[:transaction_id] = tx.transaction_id
1365
+ yield tx
1366
+ commit_resp = @project.service.commit \
1367
+ tx.session.path, tx.mutations,
1368
+ transaction_id: tx.transaction_id,
1369
+ commit_options: commit_options,
1370
+ call_options: call_options
1371
+ resp = CommitResponse.from_grpc commit_resp
1372
+ commit_options ? resp : resp.timestamp
1373
+ rescue GRPC::Aborted, Google::Cloud::AbortedError => e
1374
+ # Re-raise if deadline has passed
1375
+ if current_time - start_time > deadline
1376
+ if e.is_a? GRPC::BadStatus
1377
+ e = Google::Cloud::Error.from_error e
1382
1378
  end
1383
- # Sleep the amount from RetryDelay, or incremental backoff
1384
- sleep(delay_from_aborted(err) || backoff *= 1.3)
1385
- # Create new transaction on the session and retry the block
1386
- tx = tx.session.create_transaction
1387
- retry
1388
- rescue StandardError => err
1389
- # Rollback transaction when handling unexpected error
1390
- tx.session.rollback tx.transaction_id
1391
- # Return nil if raised with rollback.
1392
- return nil if err.is_a? Rollback
1393
- # Re-raise error.
1394
- raise err
1395
- ensure
1396
- Thread.current[:transaction_id] = nil
1379
+ raise e
1397
1380
  end
1381
+ # Sleep the amount from RetryDelay, or incremental backoff
1382
+ sleep(delay_from_aborted(e) || backoff *= 1.3)
1383
+ # Create new transaction on the session and retry the block
1384
+ tx = tx.session.create_transaction
1385
+ retry
1386
+ rescue StandardError => e
1387
+ # Rollback transaction when handling unexpected error
1388
+ tx.session.rollback tx.transaction_id
1389
+ # Return nil if raised with rollback.
1390
+ return nil if e.is_a? Rollback
1391
+ # Re-raise error.
1392
+ raise e
1393
+ ensure
1394
+ Thread.current[:transaction_id] = nil
1398
1395
  end
1399
1396
  end
1400
1397
 
1401
1398
  # rubocop:enable Metrics/AbcSize
1402
- # rubocop:enable Metrics/BlockLength
1403
1399
  # rubocop:enable Metrics/MethodLength
1404
1400
 
1405
1401
  ##
@@ -1481,18 +1477,16 @@ module Google
1481
1477
  end
1482
1478
 
1483
1479
  @pool.with_session do |session|
1484
- begin
1485
- snp_grpc = @project.service.create_snapshot \
1486
- session.path, strong: strong,
1487
- timestamp: (timestamp || read_timestamp),
1488
- staleness: (staleness || exact_staleness),
1489
- call_options: call_options
1490
- Thread.current[:transaction_id] = snp_grpc.id
1491
- snp = Snapshot.from_grpc snp_grpc, session
1492
- yield snp if block_given?
1493
- ensure
1494
- Thread.current[:transaction_id] = nil
1495
- end
1480
+ snp_grpc = @project.service.create_snapshot \
1481
+ session.path, strong: strong,
1482
+ timestamp: (timestamp || read_timestamp),
1483
+ staleness: (staleness || exact_staleness),
1484
+ call_options: call_options
1485
+ Thread.current[:transaction_id] = snp_grpc.id
1486
+ snp = Snapshot.from_grpc snp_grpc, session
1487
+ yield snp if block_given?
1488
+ ensure
1489
+ Thread.current[:transaction_id] = nil
1496
1490
  end
1497
1491
  nil
1498
1492
  end
@@ -1691,7 +1685,7 @@ module Google
1691
1685
  def batch_create_new_sessions total
1692
1686
  sessions = []
1693
1687
  remaining = total
1694
- while remaining > 0
1688
+ while remaining.positive?
1695
1689
  sessions += batch_create_sessions remaining
1696
1690
  remaining = total - sessions.count
1697
1691
  end
@@ -1795,7 +1789,7 @@ module Google
1795
1789
 
1796
1790
  def validate_deadline deadline
1797
1791
  return 120 unless deadline.is_a? Numeric
1798
- return 120 if deadline < 0
1792
+ return 120 if deadline.negative?
1799
1793
  deadline
1800
1794
  end
1801
1795
 
@@ -1816,7 +1810,7 @@ module Google
1816
1810
  seconds = err.metadata["retryDelay"]["seconds"].to_i
1817
1811
  nanos = err.metadata["retryDelay"]["nanos"].to_i
1818
1812
  return seconds if nanos.zero?
1819
- return seconds + (nanos / 1000000000.0)
1813
+ return seconds + (nanos / 1_000_000_000.0)
1820
1814
  end
1821
1815
  # No metadata? Try the inner error
1822
1816
  delay_from_aborted err.cause
@@ -139,9 +139,10 @@ module Google
139
139
  #
140
140
  def to_a skip_dup_check: nil
141
141
  values.map do |value|
142
- if value.is_a? Data
142
+ case value
143
+ when Data
143
144
  value.to_h skip_dup_check: skip_dup_check
144
- elsif value.is_a? Array
145
+ when Array
145
146
  value.map do |v|
146
147
  v.is_a?(Data) ? v.to_h(skip_dup_check: skip_dup_check) : v
147
148
  end
@@ -169,9 +170,7 @@ module Google
169
170
  # or indexes and corresponding values.
170
171
  #
171
172
  def to_h skip_dup_check: nil
172
- unless skip_dup_check
173
- raise DuplicateNameError if fields.duplicate_names?
174
- end
173
+ raise DuplicateNameError if !skip_dup_check && fields.duplicate_names?
175
174
 
176
175
  Hash[keys.zip to_a(skip_dup_check: skip_dup_check)]
177
176
  end
@@ -130,12 +130,12 @@ module Google
130
130
  # job.database.database_id
131
131
  # end
132
132
  #
133
- def all
133
+ def all &block
134
134
  return enum_for :all unless block_given?
135
135
 
136
136
  results = self
137
137
  loop do
138
- results.each { |r| yield r }
138
+ results.each(&block)
139
139
  break unless next?
140
140
  grpc.next_page
141
141
  results = self.class.from_grpc grpc, service
@@ -71,7 +71,7 @@ module Google
71
71
  return nil unless next?
72
72
  ensure_service!
73
73
  options = { token: token, max: @max }
74
- grpc = @service.list_databases @instance_id, options
74
+ grpc = @service.list_databases @instance_id, **options
75
75
  self.class.from_grpc grpc, @service, @max
76
76
  end
77
77
 
@@ -123,17 +123,17 @@ module Google
123
123
  # puts database.database_id
124
124
  # end
125
125
  #
126
- def all request_limit: nil
126
+ def all request_limit: nil, &block
127
127
  request_limit = request_limit.to_i if request_limit
128
128
  unless block_given?
129
129
  return enum_for :all, request_limit: request_limit
130
130
  end
131
131
  results = self
132
132
  loop do
133
- results.each { |r| yield r }
133
+ results.each(&block)
134
134
  if request_limit
135
135
  request_limit -= 1
136
- break if request_limit < 0
136
+ break if request_limit.negative?
137
137
  end
138
138
  break unless results.next?
139
139
  results = results.next
@@ -133,13 +133,14 @@ module Google
133
133
  #
134
134
  def types
135
135
  @grpc_fields.map(&:type).map do |type|
136
- if type.code == :ARRAY
136
+ case type.code
137
+ when :ARRAY
137
138
  if type.array_element_type.code == :STRUCT
138
139
  [Fields.from_grpc(type.array_element_type.struct_type.fields)]
139
140
  else
140
141
  [type.array_element_type.code]
141
142
  end
142
- elsif type.code == :STRUCT
143
+ when :STRUCT
143
144
  Fields.from_grpc type.struct_type.fields
144
145
  else
145
146
  type.code
@@ -73,7 +73,7 @@ module Google
73
73
  return nil unless next?
74
74
  ensure_service!
75
75
  options = { token: token, max: @max }
76
- grpc = @service.list_instance_configs options
76
+ grpc = @service.list_instance_configs(**options)
77
77
  self.class.from_grpc grpc, @service, @max
78
78
  end
79
79
 
@@ -123,17 +123,17 @@ module Google
123
123
  # puts config.instance_config_id
124
124
  # end
125
125
  #
126
- def all request_limit: nil
126
+ def all request_limit: nil, &block
127
127
  request_limit = request_limit.to_i if request_limit
128
128
  unless block_given?
129
129
  return enum_for :all, request_limit: request_limit
130
130
  end
131
131
  results = self
132
132
  loop do
133
- results.each { |r| yield r }
133
+ results.each(&block)
134
134
  if request_limit
135
135
  request_limit -= 1
136
- break if request_limit < 0
136
+ break if request_limit.negative?
137
137
  end
138
138
  break unless results.next?
139
139
  results = results.next
@@ -71,7 +71,7 @@ module Google
71
71
  return nil unless next?
72
72
  ensure_service!
73
73
  options = { token: token, max: @max }
74
- grpc = @service.list_instances options
74
+ grpc = @service.list_instances(**options)
75
75
  self.class.from_grpc grpc, @service, @max
76
76
  end
77
77
 
@@ -120,17 +120,17 @@ module Google
120
120
  # puts instance.instance_id
121
121
  # end
122
122
  #
123
- def all request_limit: nil
123
+ def all request_limit: nil, &block
124
124
  request_limit = request_limit.to_i if request_limit
125
125
  unless block_given?
126
126
  return enum_for :all, request_limit: request_limit
127
127
  end
128
128
  results = self
129
129
  loop do
130
- results.each { |r| yield r }
130
+ results.each(&block)
131
131
  if request_limit
132
132
  request_limit -= 1
133
- break if request_limit < 0
133
+ break if request_limit.negative?
134
134
  end
135
135
  break unless results.next?
136
136
  results = results.next
@@ -45,11 +45,13 @@ module Google
45
45
  #
46
46
  class Partition
47
47
  # @ private
48
- attr_reader :execute, :read
48
+ attr_reader :execute
49
+ attr_reader :read
49
50
 
50
51
  ##
51
52
  # @private Creates a Partition object.
52
- def initialize; end
53
+ def initialize
54
+ end
53
55
 
54
56
  ##
55
57
  # Whether the partition was created for an execute_query/query
@@ -70,7 +70,8 @@ module Google
70
70
  # end
71
71
  #
72
72
  class Policy
73
- attr_reader :etag, :roles
73
+ attr_reader :etag
74
+ attr_reader :roles
74
75
 
75
76
  ##
76
77
  # @private Creates a Policy object.
@@ -169,7 +170,7 @@ module Google
169
170
  role: role_name,
170
171
  members: roles[role_name]
171
172
  )
172
- end
173
+ end.compact
173
174
  )
174
175
  end
175
176
 
@@ -29,7 +29,9 @@ module Google
29
29
  # {Google::Cloud::Spanner::Session} instances.
30
30
  #
31
31
  class Pool
32
- attr_accessor :all_sessions, :session_queue, :transaction_queue
32
+ attr_accessor :all_sessions
33
+ attr_accessor :session_queue
34
+ attr_accessor :transaction_queue
33
35
 
34
36
  def initialize client, min: 10, max: 100, keepalive: 1800,
35
37
  write_ratio: 0.3, fail: true, threads: nil
@@ -38,7 +40,7 @@ module Google
38
40
  @max = max
39
41
  @keepalive = keepalive
40
42
  @write_ratio = write_ratio
41
- @write_ratio = 0 if write_ratio < 0
43
+ @write_ratio = 0 if write_ratio.negative?
42
44
  @write_ratio = 1 if write_ratio > 1
43
45
  @fail = fail
44
46
  @threads = threads || [2, Concurrent.processor_count * 2].max
@@ -143,13 +145,13 @@ module Google
143
145
  return new_transaction! if action == :new
144
146
  end
145
147
 
146
- def checkin_transaction tx
148
+ def checkin_transaction txn
147
149
  @mutex.synchronize do
148
- unless all_sessions.include? tx.session
150
+ unless all_sessions.include? txn.session
149
151
  raise ArgumentError, "Cannot checkin session"
150
152
  end
151
153
 
152
- transaction_queue.push tx
154
+ transaction_queue.push txn
153
155
 
154
156
  @resource.signal
155
157
  end
@@ -182,7 +184,7 @@ module Google
182
184
  @mutex.synchronize do
183
185
  available_count = session_queue.count + transaction_queue.count
184
186
  release_count = @min - available_count
185
- release_count = 0 if release_count < 0
187
+ release_count = 0 if release_count.negative?
186
188
 
187
189
  to_keepalive += (session_queue + transaction_queue).select do |x|
188
190
  x.idle_since? @keepalive
@@ -282,10 +284,8 @@ module Google
282
284
  @keepalive_task.execute
283
285
  end
284
286
 
285
- def future
286
- Concurrent::Future.new executor: @thread_pool do
287
- yield
288
- end.execute
287
+ def future &block
288
+ Concurrent::Future.new(executor: @thread_pool, &block).execute
289
289
  end
290
290
  end
291
291
  end
@@ -251,14 +251,14 @@ module Google
251
251
  @service.execute_streaming_sql(
252
252
  @session_path,
253
253
  @sql,
254
- @execute_query_options.merge(resume_token: resume_token)
254
+ **@execute_query_options.merge(resume_token: resume_token)
255
255
  )
256
256
  else
257
257
  @service.streaming_read_table(
258
258
  @session_path,
259
259
  @table,
260
260
  @columns,
261
- @read_options.merge(resume_token: resume_token)
261
+ **@read_options.merge(resume_token: resume_token)
262
262
  )
263
263
  end
264
264
  end
@@ -268,9 +268,9 @@ module Google
268
268
  # Retries a request, by re-executing it from scratch.
269
269
  def retry_request
270
270
  if @execute_query_options
271
- @service.execute_streaming_sql @session_path, @sql, @execute_query_options
271
+ @service.execute_streaming_sql @session_path, @sql, **@execute_query_options
272
272
  else
273
- @service.streaming_read_table @session_path, @table, @columns, @read_options
273
+ @service.streaming_read_table @session_path, @table, @columns, **@read_options
274
274
  end
275
275
  end
276
276
 
@@ -326,7 +326,7 @@ module Google
326
326
  query_options: query_options, call_options: call_options
327
327
  }
328
328
  enum = service.execute_streaming_sql session_path, sql,
329
- execute_query_options
329
+ **execute_query_options
330
330
  from_enum(enum, service).tap do |results|
331
331
  results.instance_variable_set :@session_path, session_path
332
332
  results.instance_variable_set :@sql, sql
@@ -346,7 +346,7 @@ module Google
346
346
  call_options: call_options
347
347
  }
348
348
  enum = service.streaming_read_table \
349
- session_path, table, columns, read_options
349
+ session_path, table, columns, **read_options
350
350
  from_enum(enum, service).tap do |results|
351
351
  results.instance_variable_set :@session_path, session_path
352
352
  results.instance_variable_set :@table, table
@@ -28,8 +28,12 @@ module Google
28
28
  # @private Represents the gRPC Spanner service, including all the API
29
29
  # methods.
30
30
  class Service
31
- attr_accessor :project, :credentials, :timeout, :host, :lib_name,
32
- :lib_version
31
+ attr_accessor :project
32
+ attr_accessor :credentials
33
+ attr_accessor :timeout
34
+ attr_accessor :host
35
+ attr_accessor :lib_name
36
+ attr_accessor :lib_version
33
37
 
34
38
  ##
35
39
  # Creates a new Service instance.
@@ -639,7 +639,7 @@ module Google
639
639
  commit_options: commit_options,
640
640
  call_options: call_options
641
641
  }
642
- commit opts do |c|
642
+ commit(**opts) do |c|
643
643
  c.upsert table, rows
644
644
  end
645
645
  end
@@ -728,7 +728,7 @@ module Google
728
728
  commit_options: commit_options,
729
729
  call_options: call_options
730
730
  }
731
- commit opts do |c|
731
+ commit(**opts) do |c|
732
732
  c.insert table, rows
733
733
  end
734
734
  end
@@ -816,7 +816,7 @@ module Google
816
816
  commit_options: commit_options,
817
817
  call_options: call_options
818
818
  }
819
- commit opts do |c|
819
+ commit(**opts) do |c|
820
820
  c.update table, rows
821
821
  end
822
822
  end
@@ -906,7 +906,7 @@ module Google
906
906
  commit_options: commit_options,
907
907
  call_options: call_options
908
908
  }
909
- commit opts do |c|
909
+ commit(**opts) do |c|
910
910
  c.replace table, rows
911
911
  end
912
912
  end
@@ -974,7 +974,7 @@ module Google
974
974
  commit_options: commit_options,
975
975
  call_options: call_options
976
976
  }
977
- commit opts do |c|
977
+ commit(**opts) do |c|
978
978
  c.delete table, keys
979
979
  end
980
980
  end
@@ -49,7 +49,10 @@ module Google
49
49
  # end
50
50
  #
51
51
  class Status
52
- attr_reader :code, :description, :message, :details
52
+ attr_reader :code
53
+ attr_reader :description
54
+ attr_reader :message
55
+ attr_reader :details
53
56
 
54
57
  ##
55
58
  # @private Creates a Status object.
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Spanner
19
- VERSION = "2.4.0".freeze
19
+ VERSION = "2.5.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.4.0
4
+ version: 2.5.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-02-18 00:00:00.000000000 Z
12
+ date: 2021-03-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-cloud-core
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: 1.24.0
90
+ version: 1.25.1
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: 1.24.0
97
+ version: 1.25.1
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: minitest
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -227,28 +227,28 @@ dependencies:
227
227
  requirements:
228
228
  - - "~>"
229
229
  - !ruby/object:Gem::Version
230
- version: 1.28.0
230
+ version: '1.36'
231
231
  type: :development
232
232
  prerelease: false
233
233
  version_requirements: !ruby/object:Gem::Requirement
234
234
  requirements:
235
235
  - - "~>"
236
236
  - !ruby/object:Gem::Version
237
- version: 1.28.0
237
+ version: '1.36'
238
238
  - !ruby/object:Gem::Dependency
239
239
  name: grpc-tools
240
240
  requirement: !ruby/object:Gem::Requirement
241
241
  requirements:
242
242
  - - "~>"
243
243
  - !ruby/object:Gem::Version
244
- version: 1.26.0
244
+ version: '1.36'
245
245
  type: :development
246
246
  prerelease: false
247
247
  version_requirements: !ruby/object:Gem::Requirement
248
248
  requirements:
249
249
  - - "~>"
250
250
  - !ruby/object:Gem::Version
251
- version: 1.26.0
251
+ version: '1.36'
252
252
  description: google-cloud-spanner is the official library for Google Cloud Spanner
253
253
  API.
254
254
  email:
@@ -324,14 +324,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
324
324
  requirements:
325
325
  - - ">="
326
326
  - !ruby/object:Gem::Version
327
- version: '2.4'
327
+ version: '2.5'
328
328
  required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  requirements:
330
330
  - - ">="
331
331
  - !ruby/object:Gem::Version
332
332
  version: '0'
333
333
  requirements: []
334
- rubygems_version: 3.2.6
334
+ rubygems_version: 3.2.13
335
335
  signing_key:
336
336
  specification_version: 4
337
337
  summary: API Client library for Google Cloud Spanner API