google-cloud-firestore 2.3.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,10 @@ module Google
26
26
  # @private Represents the gRPC Firestore service, including all the API
27
27
  # methods.
28
28
  class Service
29
- attr_accessor :project, :credentials, :timeout, :host
29
+ attr_accessor :project
30
+ attr_accessor :credentials
31
+ attr_accessor :timeout
32
+ attr_accessor :host
30
33
 
31
34
  ##
32
35
  # Creates a new Service instance.
@@ -93,6 +96,20 @@ module Google
93
96
  )
94
97
  end
95
98
 
99
+ ##
100
+ # Returns Google::Cloud::Firestore::V1::PartitionQueryResponse
101
+ def partition_query parent, query_grpc, partition_count, token: nil, max: nil
102
+ request = Google::Cloud::Firestore::V1::PartitionQueryRequest.new(
103
+ parent: parent,
104
+ structured_query: query_grpc,
105
+ partition_count: partition_count,
106
+ page_token: token,
107
+ page_size: max
108
+ )
109
+ paged_enum = firestore.partition_query request
110
+ paged_enum.response
111
+ end
112
+
96
113
  def run_query path, query_grpc, transaction: nil
97
114
  run_query_req = {
98
115
  parent: path,
@@ -131,7 +131,7 @@ module Google
131
131
  ensure_service!
132
132
 
133
133
  unless block_given?
134
- return enum_for :get_all, docs, field_mask: field_mask
134
+ return enum_for :get_all, *docs, field_mask: field_mask
135
135
  end
136
136
 
137
137
  doc_paths = Array(docs).flatten.map do |doc_path|
@@ -321,7 +321,7 @@ module Google
321
321
 
322
322
  doc_path = coalesce_doc_path_argument doc
323
323
 
324
- @writes << Convert.writes_for_create(doc_path, data)
324
+ @writes << Convert.write_for_create(doc_path, data)
325
325
 
326
326
  nil
327
327
  end
@@ -422,7 +422,7 @@ module Google
422
422
 
423
423
  doc_path = coalesce_doc_path_argument doc
424
424
 
425
- @writes << Convert.writes_for_set(doc_path, data, merge: merge)
425
+ @writes << Convert.write_for_set(doc_path, data, merge: merge)
426
426
 
427
427
  nil
428
428
  end
@@ -526,8 +526,8 @@ module Google
526
526
 
527
527
  doc_path = coalesce_doc_path_argument doc
528
528
 
529
- @writes << Convert.writes_for_update(doc_path, data,
530
- update_time: update_time)
529
+ @writes << Convert.write_for_update(doc_path, data,
530
+ update_time: update_time)
531
531
 
532
532
  nil
533
533
  end
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module Firestore
19
- VERSION = "2.3.0".freeze
19
+ VERSION = "2.6.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -33,7 +33,8 @@ module Google
33
33
  # make inserting and removing objects much more efficent.
34
34
  class Inventory
35
35
  attr_accessor :current
36
- attr_reader :resume_token, :read_time
36
+ attr_reader :resume_token
37
+ attr_reader :read_time
37
38
 
38
39
  def initialize client, query
39
40
  @client = client
@@ -155,24 +156,24 @@ module Google
155
156
 
156
157
  protected
157
158
 
158
- def query_comparison_proc a, b
159
+ def query_comparison_proc left, right
159
160
  # TODO: Remove this when done benchmarking
160
161
  @comp_proc_counter += 1
161
162
 
162
- return Order.compare_field_values a.ref, b.ref if @query.nil?
163
+ return Order.compare_field_values left.ref, right.ref if @query.nil?
163
164
 
164
165
  @directions ||= @query.query.order_by.map(&:direction)
165
166
 
166
- a_comps = a.query_comparisons_for @query.query
167
- b_comps = b.query_comparisons_for @query.query
168
- @directions.zip(a_comps, b_comps).each do |dir, a_comp, b_comp|
169
- comp = a_comp <=> b_comp
167
+ left_comps = left.query_comparisons_for @query.query
168
+ right_comps = right.query_comparisons_for @query.query
169
+ @directions.zip(left_comps, right_comps).each do |dir, left_comp, right_comp|
170
+ comp = left_comp <=> right_comp
170
171
  comp = 0 - comp if dir == :DESCENDING
171
172
  return comp unless comp.zero?
172
173
  end
173
174
 
174
175
  # Compare paths when everything else is equal
175
- ref_comp = Order.compare_field_values a.ref, b.ref
176
+ ref_comp = Order.compare_field_values left.ref, right.ref
176
177
  ref_comp = 0 - ref_comp if @directions.last == :DESCENDING
177
178
  ref_comp
178
179
  end
@@ -83,7 +83,7 @@ module Google
83
83
  def stop
84
84
  synchronize do
85
85
  @stopped = true
86
- @request_queue.push self if @request_queue
86
+ @request_queue&.push self
87
87
  end
88
88
  end
89
89
 
@@ -271,9 +271,8 @@ module Google
271
271
 
272
272
  # We must be stopped, tell the stream to quit.
273
273
  @request_queue.push self
274
- rescue GRPC::Cancelled, GRPC::DeadlineExceeded, GRPC::Internal,
275
- GRPC::ResourceExhausted, GRPC::Unauthenticated,
276
- GRPC::Unavailable, GRPC::Core::CallError => e
274
+ rescue GRPC::Cancelled, GRPC::DeadlineExceeded, GRPC::Internal, GRPC::ResourceExhausted,
275
+ GRPC::Unauthenticated, GRPC::Unavailable, GRPC::Unknown, GRPC::Core::CallError => e
277
276
  # Restart the stream with an incremental back for a retriable error.
278
277
  # Also when GRPC raises the internal CallError.
279
278
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-firestore
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-30 00:00:00.000000000 Z
11
+ date: 2021-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-cloud-core
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.24.0
75
+ version: 1.25.1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.24.0
82
+ version: 1.25.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -227,6 +227,7 @@ files:
227
227
  - lib/google/cloud/firestore.rb
228
228
  - lib/google/cloud/firestore/batch.rb
229
229
  - lib/google/cloud/firestore/client.rb
230
+ - lib/google/cloud/firestore/collection_group.rb
230
231
  - lib/google/cloud/firestore/collection_reference.rb
231
232
  - lib/google/cloud/firestore/collection_reference_list.rb
232
233
  - lib/google/cloud/firestore/commit_response.rb
@@ -242,7 +243,9 @@ files:
242
243
  - lib/google/cloud/firestore/generate.rb
243
244
  - lib/google/cloud/firestore/query.rb
244
245
  - lib/google/cloud/firestore/query_listener.rb
246
+ - lib/google/cloud/firestore/query_partition.rb
245
247
  - lib/google/cloud/firestore/query_snapshot.rb
248
+ - lib/google/cloud/firestore/resource_path.rb
246
249
  - lib/google/cloud/firestore/service.rb
247
250
  - lib/google/cloud/firestore/transaction.rb
248
251
  - lib/google/cloud/firestore/version.rb
@@ -262,14 +265,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
265
  requirements:
263
266
  - - ">="
264
267
  - !ruby/object:Gem::Version
265
- version: '2.4'
268
+ version: '2.5'
266
269
  required_rubygems_version: !ruby/object:Gem::Requirement
267
270
  requirements:
268
271
  - - ">="
269
272
  - !ruby/object:Gem::Version
270
273
  version: '0'
271
274
  requirements: []
272
- rubygems_version: 3.1.4
275
+ rubygems_version: 3.2.17
273
276
  signing_key:
274
277
  specification_version: 4
275
278
  summary: API Client library for Google Cloud Firestore API