google-cloud-datastore 2.1.0 → 2.2.3
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 +24 -0
- data/CONTRIBUTING.md +3 -3
- data/LOGGING.md +1 -1
- data/lib/google/cloud/datastore/dataset/lookup_results.rb +5 -5
- data/lib/google/cloud/datastore/dataset/query_results.rb +6 -6
- data/lib/google/cloud/datastore/dataset.rb +3 -3
- data/lib/google/cloud/datastore/entity.rb +1 -1
- data/lib/google/cloud/datastore/gql_query.rb +18 -22
- data/lib/google/cloud/datastore/key.rb +4 -3
- data/lib/google/cloud/datastore/query.rb +3 -2
- data/lib/google/cloud/datastore/service.rb +4 -1
- data/lib/google/cloud/datastore/transaction.rb +1 -1
- data/lib/google/cloud/datastore/version.rb +1 -1
- data/lib/google/cloud/datastore.rb +2 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5a916b746fc52de5e51b15ba2e9f78bfa8a007017be5e2c9f79aa73ed5e7375
|
4
|
+
data.tar.gz: beaf302cd7963e9da82ec1fde9fa9079f73660688e7ca52cb9fa3d6a8a3aa7a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f96129ab0a9640752375f94c605825c10ebcb6e60c5c83cf574a1db8a76e1ef2eef3ed7d4a56b823985f7e39e1eb842b6fe45e89788d773fd3adfe25e9d0f93
|
7
|
+
data.tar.gz: 8d19db5f56e24bfae7dfafbac92d8134a3ee30832c5decb8b0951353c0fc432e3ff1e854c245213a468a5ebdba6f03024ebf214da5242e70fa711b608a536af3
|
data/AUTHENTICATION.md
CHANGED
@@ -96,7 +96,8 @@ client = Google::Cloud::Datastore.new
|
|
96
96
|
|
97
97
|
### Configuration
|
98
98
|
|
99
|
-
The **Project ID** and **Credentials JSON** can be configured
|
99
|
+
The **Project ID** and the path to the **Credentials JSON** file can be configured
|
100
|
+
instead of placing them in environment variables or providing them as arguments.
|
100
101
|
|
101
102
|
```ruby
|
102
103
|
require "google/cloud/datastore"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,29 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 2.2.3 / 2021-10-21
|
4
|
+
|
5
|
+
#### Documentation
|
6
|
+
|
7
|
+
* Add documentation for quota_project Configuration attribute
|
8
|
+
|
9
|
+
### 2.2.2 / 2021-09-21
|
10
|
+
|
11
|
+
#### Documentation
|
12
|
+
|
13
|
+
* Fix typo in Emulator guide links
|
14
|
+
|
15
|
+
### 2.2.1 / 2021-07-08
|
16
|
+
|
17
|
+
#### Documentation
|
18
|
+
|
19
|
+
* Update AUTHENTICATION.md in handwritten packages
|
20
|
+
|
21
|
+
### 2.2.0 / 2021-03-10
|
22
|
+
|
23
|
+
#### Features
|
24
|
+
|
25
|
+
* Drop support for Ruby 2.4 and add support for Ruby 3.0
|
26
|
+
|
3
27
|
### 2.1.0 / 2020-09-17
|
4
28
|
|
5
29
|
#### 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-datastore console and run the project's tests,
|
25
25
|
there is a small amount of setup:
|
26
26
|
|
27
|
-
1. Install Ruby. google-cloud-datastore requires Ruby 2.
|
27
|
+
1. Install Ruby. google-cloud-datastore 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).
|
@@ -45,7 +45,7 @@ there is a small amount of setup:
|
|
45
45
|
|
46
46
|
```sh
|
47
47
|
$ cd google-cloud-datastore/
|
48
|
-
$ bundle
|
48
|
+
$ bundle install
|
49
49
|
```
|
50
50
|
|
51
51
|
## Console
|
@@ -119,7 +119,7 @@ If you alter an example's title, you may encounter breaking tests.
|
|
119
119
|
### Datastore Acceptance Tests
|
120
120
|
|
121
121
|
The Datastore acceptance tests interact with the live service API. Follow the
|
122
|
-
instructions in the {file:AUTHENTICATION.md Authentication
|
122
|
+
instructions in the {file:AUTHENTICATION.md Authentication Guide} for enabling
|
123
123
|
the Datastore API. Occasionally, some API features may not yet be generally
|
124
124
|
available, making it difficult for some contributors to successfully run the
|
125
125
|
entire acceptance test suite. However, please ensure that you do successfully
|
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
|
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
|
@@ -167,17 +167,17 @@ module Google
|
|
167
167
|
# puts "Task #{t.key.id} (#cursor)"
|
168
168
|
# end
|
169
169
|
#
|
170
|
-
def all request_limit: nil
|
170
|
+
def all request_limit: nil, &block
|
171
171
|
request_limit = request_limit.to_i if request_limit
|
172
172
|
unless block_given?
|
173
173
|
return enum_for :all, request_limit: request_limit
|
174
174
|
end
|
175
175
|
results = self
|
176
176
|
loop do
|
177
|
-
results.each
|
177
|
+
results.each(&block)
|
178
178
|
if request_limit
|
179
179
|
request_limit -= 1
|
180
|
-
break if request_limit
|
180
|
+
break if request_limit.negative?
|
181
181
|
end
|
182
182
|
break unless results.next?
|
183
183
|
results = results.next
|
@@ -187,14 +187,14 @@ module Google
|
|
187
187
|
##
|
188
188
|
# @private New Dataset::LookupResults from a
|
189
189
|
# Google::Dataset::V1::LookupResponse object.
|
190
|
-
def self.from_grpc lookup_res, service, consistency = nil,
|
190
|
+
def self.from_grpc lookup_res, service, consistency = nil, transaction = nil
|
191
191
|
entities = to_gcloud_entities lookup_res.found
|
192
192
|
deferred = to_gcloud_keys lookup_res.deferred
|
193
193
|
missing = to_gcloud_entities lookup_res.missing
|
194
194
|
new(entities).tap do |lr|
|
195
195
|
lr.instance_variable_set :@service, service
|
196
196
|
lr.instance_variable_set :@consistency, consistency
|
197
|
-
lr.instance_variable_set :@transaction,
|
197
|
+
lr.instance_variable_set :@transaction, transaction
|
198
198
|
lr.instance_variable_set :@deferred, deferred
|
199
199
|
lr.instance_variable_set :@missing, missing
|
200
200
|
end
|
@@ -266,17 +266,17 @@ module Google
|
|
266
266
|
# puts "Task #{t.key.id} (#cursor)"
|
267
267
|
# end
|
268
268
|
#
|
269
|
-
def all request_limit: nil
|
269
|
+
def all request_limit: nil, &block
|
270
270
|
request_limit = request_limit.to_i if request_limit
|
271
271
|
unless block_given?
|
272
272
|
return enum_for :all, request_limit: request_limit
|
273
273
|
end
|
274
274
|
results = self
|
275
275
|
loop do
|
276
|
-
results.each
|
276
|
+
results.each(&block)
|
277
277
|
if request_limit
|
278
278
|
request_limit -= 1
|
279
|
-
break if request_limit
|
279
|
+
break if request_limit.negative?
|
280
280
|
end
|
281
281
|
break unless results.next?
|
282
282
|
results = results.next
|
@@ -335,7 +335,7 @@ module Google
|
|
335
335
|
# puts "Task #{task.key.id} (#cursor)"
|
336
336
|
# end
|
337
337
|
#
|
338
|
-
def all_with_cursor request_limit: nil
|
338
|
+
def all_with_cursor request_limit: nil, &block
|
339
339
|
request_limit = request_limit.to_i if request_limit
|
340
340
|
unless block_given?
|
341
341
|
return enum_for :all_with_cursor, request_limit: request_limit
|
@@ -343,10 +343,10 @@ module Google
|
|
343
343
|
results = self
|
344
344
|
|
345
345
|
loop do
|
346
|
-
results.zip(results.cursors).each
|
346
|
+
results.zip(results.cursors).each(&block)
|
347
347
|
if request_limit
|
348
348
|
request_limit -= 1
|
349
|
-
break if request_limit
|
349
|
+
break if request_limit.negative?
|
350
350
|
end
|
351
351
|
break unless results.next?
|
352
352
|
results = results.next
|
@@ -535,9 +535,9 @@ module Google
|
|
535
535
|
begin
|
536
536
|
yield tx
|
537
537
|
tx.commit
|
538
|
-
rescue Google::Cloud::UnavailableError =>
|
538
|
+
rescue Google::Cloud::UnavailableError => e
|
539
539
|
# Re-raise if deadline has passed
|
540
|
-
raise
|
540
|
+
raise e if Time.now - start_time > deadline
|
541
541
|
|
542
542
|
# Sleep with incremental backoff
|
543
543
|
sleep backoff *= 1.3
|
@@ -878,7 +878,7 @@ module Google
|
|
878
878
|
|
879
879
|
def validate_deadline deadline
|
880
880
|
return 60 unless deadline.is_a? Numeric
|
881
|
-
return 60 if deadline
|
881
|
+
return 60 if deadline.negative?
|
882
882
|
deadline
|
883
883
|
end
|
884
884
|
|
@@ -157,17 +157,15 @@ module Google
|
|
157
157
|
def named_bindings= new_named_bindings
|
158
158
|
@grpc.named_bindings.clear
|
159
159
|
new_named_bindings.map do |name, value|
|
160
|
-
if value.is_a? Google::Cloud::Datastore::Cursor
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
)
|
170
|
-
end
|
160
|
+
@grpc.named_bindings[name.to_s] = if value.is_a? Google::Cloud::Datastore::Cursor
|
161
|
+
Google::Cloud::Datastore::V1::GqlQueryParameter.new(
|
162
|
+
cursor: value.to_grpc
|
163
|
+
)
|
164
|
+
else
|
165
|
+
Google::Cloud::Datastore::V1::GqlQueryParameter.new(
|
166
|
+
value: Convert.to_value(value)
|
167
|
+
)
|
168
|
+
end
|
171
169
|
end
|
172
170
|
end
|
173
171
|
|
@@ -208,17 +206,15 @@ module Google
|
|
208
206
|
def positional_bindings= new_positional_bindings
|
209
207
|
@grpc.positional_bindings.clear
|
210
208
|
new_positional_bindings.map do |value|
|
211
|
-
if value.is_a? Google::Cloud::Datastore::Cursor
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
)
|
221
|
-
end
|
209
|
+
@grpc.positional_bindings << if value.is_a? Google::Cloud::Datastore::Cursor
|
210
|
+
Google::Cloud::Datastore::V1::GqlQueryParameter.new(
|
211
|
+
cursor: value.to_grpc
|
212
|
+
)
|
213
|
+
else
|
214
|
+
Google::Cloud::Datastore::V1::GqlQueryParameter.new(
|
215
|
+
value: Convert.to_value(value)
|
216
|
+
)
|
217
|
+
end
|
222
218
|
end
|
223
219
|
end
|
224
220
|
|
@@ -272,9 +272,10 @@ module Google
|
|
272
272
|
def to_grpc
|
273
273
|
grpc_path = path.map do |pe_kind, pe_id_or_name|
|
274
274
|
path_args = { kind: pe_kind }
|
275
|
-
|
275
|
+
case pe_id_or_name
|
276
|
+
when Integer
|
276
277
|
path_args[:id] = pe_id_or_name
|
277
|
-
|
278
|
+
when String
|
278
279
|
path_args[:name] = pe_id_or_name unless pe_id_or_name.empty?
|
279
280
|
end
|
280
281
|
Google::Cloud::Datastore::V1::Key::PathElement.new path_args
|
@@ -305,7 +306,7 @@ module Google
|
|
305
306
|
key.project = key_grpc.partition_id.project_id
|
306
307
|
key.namespace = key_grpc.partition_id.namespace_id
|
307
308
|
end
|
308
|
-
key.parent = Key.from_grpc key_grpc if key_grpc.path.count
|
309
|
+
key.parent = Key.from_grpc key_grpc if key_grpc.path.count.positive?
|
309
310
|
# Freeze the key to make it immutable.
|
310
311
|
key.freeze
|
311
312
|
key
|
@@ -340,9 +340,10 @@ module Google
|
|
340
340
|
# tasks = datastore.run query
|
341
341
|
#
|
342
342
|
def start cursor
|
343
|
-
|
343
|
+
case cursor
|
344
|
+
when Cursor
|
344
345
|
@grpc.start_cursor = cursor.to_grpc
|
345
|
-
|
346
|
+
when String
|
346
347
|
@grpc.start_cursor = Convert.decode_bytes cursor
|
347
348
|
else
|
348
349
|
raise ArgumentError, "Can't set a cursor using a #{cursor.class}."
|
@@ -25,7 +25,10 @@ module Google
|
|
25
25
|
# @private Represents the GAX Datastore service, including all the API
|
26
26
|
# methods.
|
27
27
|
class Service
|
28
|
-
attr_accessor :project
|
28
|
+
attr_accessor :project
|
29
|
+
attr_accessor :credentials
|
30
|
+
attr_accessor :host
|
31
|
+
attr_accessor :timeout
|
29
32
|
|
30
33
|
##
|
31
34
|
# Creates a new Service instance.
|
@@ -50,7 +50,7 @@ module Google
|
|
50
50
|
# @private Creates a new Transaction instance.
|
51
51
|
# Takes a Service instead of project and Credentials.
|
52
52
|
def initialize service, previous_transaction: nil
|
53
|
-
|
53
|
+
super service
|
54
54
|
@previous_transaction = previous_transaction
|
55
55
|
reset!
|
56
56
|
start
|
@@ -158,6 +158,8 @@ module Google
|
|
158
158
|
# parameter `keyfile` is considered deprecated, but may also be used.)
|
159
159
|
# * `scope` - (String, Array<String>) The OAuth 2.0 scopes controlling
|
160
160
|
# the set of resources and operations that the connection can access.
|
161
|
+
# * `quota_project` - (String) The project ID for a project that can be
|
162
|
+
# used by client libraries for quota and billing purposes.
|
161
163
|
# * `timeout` - (Integer) Default timeout to use in requests.
|
162
164
|
# * `endpoint` - (String) Override of the endpoint host name, or `nil`
|
163
165
|
# to use the default endpoint.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-cloud-datastore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.3
|
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:
|
12
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: google-cloud-core
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 1.
|
48
|
+
version: 1.25.1
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 1.
|
55
|
+
version: 1.25.1
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: minitest
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -228,14 +228,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
requirements:
|
229
229
|
- - ">="
|
230
230
|
- !ruby/object:Gem::Version
|
231
|
-
version: '2.
|
231
|
+
version: '2.5'
|
232
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
requirements: []
|
238
|
-
rubygems_version: 3.
|
238
|
+
rubygems_version: 3.2.17
|
239
239
|
signing_key:
|
240
240
|
specification_version: 4
|
241
241
|
summary: API Client library for Google Cloud Datastore
|