google-cloud-firestore 2.4.0 → 2.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +2 -1
- data/CHANGELOG.md +35 -0
- data/CONTRIBUTING.md +4 -5
- data/LOGGING.md +1 -1
- data/lib/google/cloud/firestore/batch.rb +3 -4
- data/lib/google/cloud/firestore/client.rb +17 -23
- data/lib/google/cloud/firestore/collection_group.rb +136 -0
- data/lib/google/cloud/firestore/collection_reference.rb +9 -6
- data/lib/google/cloud/firestore/collection_reference_list.rb +3 -3
- data/lib/google/cloud/firestore/convert.rb +151 -173
- data/lib/google/cloud/firestore/document_reference.rb +9 -2
- data/lib/google/cloud/firestore/document_reference/list.rb +5 -6
- data/lib/google/cloud/firestore/field_path.rb +2 -2
- data/lib/google/cloud/firestore/field_value.rb +7 -2
- data/lib/google/cloud/firestore/query.rb +88 -19
- data/lib/google/cloud/firestore/query_partition.rb +80 -0
- data/lib/google/cloud/firestore/resource_path.rb +58 -0
- data/lib/google/cloud/firestore/service.rb +18 -1
- data/lib/google/cloud/firestore/transaction.rb +5 -5
- data/lib/google/cloud/firestore/version.rb +1 -1
- data/lib/google/cloud/firestore/watch/inventory.rb +9 -8
- data/lib/google/cloud/firestore/watch/listener.rb +3 -4
- metadata +9 -6
@@ -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.
|
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.
|
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.
|
530
|
-
|
529
|
+
@writes << Convert.write_for_update(doc_path, data,
|
530
|
+
update_time: update_time)
|
531
531
|
|
532
532
|
nil
|
533
533
|
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
|
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
|
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
|
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
|
-
|
167
|
-
|
168
|
-
@directions.zip(
|
169
|
-
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
|
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
|
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::
|
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.
|
4
|
+
version: 2.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-08 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.
|
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.
|
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.
|
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.
|
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
|