google-cloud-datastore 0.21.0 → 0.23.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.
@@ -34,7 +34,7 @@ module Google
34
34
  client_config: nil
35
35
  @project = project
36
36
  @credentials = credentials
37
- @host = host || V1::DatastoreApi::SERVICE_ADDRESS
37
+ @host = host || V1::DatastoreClient::SERVICE_ADDRESS
38
38
  @timeout = timeout
39
39
  @client_config = client_config || {}
40
40
  end
@@ -53,7 +53,7 @@ module Google
53
53
 
54
54
  def service
55
55
  return mocked_service if mocked_service
56
- @service ||= V1::DatastoreApi.new(
56
+ @service ||= V1::DatastoreClient.new(
57
57
  service_path: host,
58
58
  channel: channel,
59
59
  timeout: timeout,
@@ -27,6 +27,10 @@ module Google
27
27
  # Transactions
28
28
  #
29
29
  # @example Transactional update:
30
+ # require "google/cloud/datastore"
31
+ #
32
+ # datastore = Google::Cloud::Datastore.new
33
+ #
30
34
  # def transfer_funds from_key, to_key, amount
31
35
  # datastore.transaction do |tx|
32
36
  # from = tx.find from_key
@@ -37,16 +41,11 @@ module Google
37
41
  # end
38
42
  # end
39
43
  #
40
- # @example Retry logic using the transactional update example above:
41
- # (1..5).each do |i|
42
- # begin
43
- # return transfer_funds from_key, to_key, amount
44
- # rescue Google::Cloud::Error => e
45
- # raise e if i == 5
46
- # end
47
- # end
48
- #
49
44
  # @example Transactional read:
45
+ # require "google/cloud/datastore"
46
+ #
47
+ # datastore = Google::Cloud::Datastore.new
48
+ #
50
49
  # task_list_key = datastore.key "TaskList", "default"
51
50
  # datastore.transaction do |tx|
52
51
  # task_list = tx.find task_list_key
@@ -70,6 +69,10 @@ module Google
70
69
  # Persist entities in a transaction.
71
70
  #
72
71
  # @example Transactional get or create:
72
+ # require "google/cloud/datastore"
73
+ #
74
+ # datastore = Google::Cloud::Datastore.new
75
+ #
73
76
  # task_key = datastore.key "Task", "sampleTask"
74
77
  #
75
78
  # task = nil
@@ -98,6 +101,10 @@ module Google
98
101
  # if the entities cannot be inserted.
99
102
  #
100
103
  # @example Transactional insert:
104
+ # require "google/cloud/datastore"
105
+ #
106
+ # datastore = Google::Cloud::Datastore.new
107
+ #
101
108
  # task_key = datastore.key "Task", "sampleTask"
102
109
  #
103
110
  # task = nil
@@ -125,6 +132,10 @@ module Google
125
132
  # if the entities cannot be updated.
126
133
  #
127
134
  # @example Transactional update:
135
+ # require "google/cloud/datastore"
136
+ #
137
+ # datastore = Google::Cloud::Datastore.new
138
+ #
128
139
  # task_key = datastore.key "Task", "sampleTask"
129
140
  #
130
141
  # task = nil
@@ -146,6 +157,10 @@ module Google
146
157
  # Remove entities in a transaction.
147
158
  #
148
159
  # @example
160
+ # require "google/cloud/datastore"
161
+ #
162
+ # datastore = Google::Cloud::Datastore.new
163
+ #
149
164
  # datastore.transaction do |tx|
150
165
  # if tx.find(task_list.key).nil?
151
166
  # tx.delete task1, task2
@@ -167,10 +182,18 @@ module Google
167
182
  # @return [Google::Cloud::Datastore::Entity, nil]
168
183
  #
169
184
  # @example Finding an entity with a key:
185
+ # require "google/cloud/datastore"
186
+ #
187
+ # datastore = Google::Cloud::Datastore.new
188
+ #
170
189
  # task_key = datastore.key "Task", "sampleTask"
171
190
  # task = datastore.find task_key
172
191
  #
173
192
  # @example Finding an entity with a `kind` and `id`/`name`:
193
+ # require "google/cloud/datastore"
194
+ #
195
+ # datastore = Google::Cloud::Datastore.new
196
+ #
174
197
  # task = datastore.find "Task", "sampleTask"
175
198
  #
176
199
  def find key_or_kind, id_or_name = nil
@@ -191,7 +214,10 @@ module Google
191
214
  # @return [Google::Cloud::Datastore::Dataset::LookupResults]
192
215
  #
193
216
  # @example
217
+ # require "google/cloud/datastore"
218
+ #
194
219
  # datastore = Google::Cloud::Datastore.new
220
+ #
195
221
  # task_key1 = datastore.key "Task", 123456
196
222
  # task_key2 = datastore.key "Task", 987654
197
223
  # tasks = datastore.find_all task_key1, task_key2
@@ -214,6 +240,10 @@ module Google
214
240
  # @return [Google::Cloud::Datastore::Dataset::QueryResults]
215
241
  #
216
242
  # @example
243
+ # require "google/cloud/datastore"
244
+ #
245
+ # datastore = Google::Cloud::Datastore.new
246
+ #
217
247
  # query = datastore.query("Task").
218
248
  # where("done", "=", false)
219
249
  # datastore.transaction do |tx|
@@ -221,6 +251,10 @@ module Google
221
251
  # end
222
252
  #
223
253
  # @example Run the query within a namespace with the `namespace` option:
254
+ # require "google/cloud/datastore"
255
+ #
256
+ # datastore = Google::Cloud::Datastore.new
257
+ #
224
258
  # query = Google::Cloud::Datastore::Query.new.kind("Task").
225
259
  # where("done", "=", false)
226
260
  # datastore.transaction do |tx|
@@ -287,8 +321,8 @@ module Google
287
321
  # tx = datastore.transaction
288
322
  # begin
289
323
  # tx.commit do |c|
290
- # c.save task1, task2
291
- # c.delete entity1, entity2
324
+ # c.save task3, task4
325
+ # c.delete task1, task2
292
326
  # end
293
327
  # rescue
294
328
  # tx.rollback
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- require "google/cloud/datastore/v1/datastore_api"
16
+ require "google/cloud/datastore/v1/datastore_client"
@@ -41,7 +41,7 @@ module Google
41
41
  #
42
42
  # @!attribute [r] datastore_stub
43
43
  # @return [Google::Datastore::V1::Datastore::Stub]
44
- class DatastoreApi
44
+ class DatastoreClient
45
45
  attr_reader :datastore_stub
46
46
 
47
47
  # The default address of the service.
@@ -165,27 +165,27 @@ module Google
165
165
  # @return [Google::Datastore::V1::LookupResponse]
166
166
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
167
167
  # @example
168
- # require "google/cloud/datastore/v1/datastore_api"
168
+ # require "google/cloud/datastore/v1/datastore_client"
169
169
  #
170
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
170
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
171
171
  # ReadOptions = Google::Datastore::V1::ReadOptions
172
172
  #
173
- # datastore_api = DatastoreApi.new
173
+ # datastore_client = DatastoreClient.new
174
174
  # project_id = ''
175
175
  # read_options = ReadOptions.new
176
176
  # keys = []
177
- # response = datastore_api.lookup(project_id, read_options, keys)
177
+ # response = datastore_client.lookup(project_id, read_options, keys)
178
178
 
179
179
  def lookup \
180
180
  project_id,
181
181
  read_options,
182
182
  keys,
183
183
  options: nil
184
- req = Google::Datastore::V1::LookupRequest.new(
184
+ req = Google::Datastore::V1::LookupRequest.new({
185
185
  project_id: project_id,
186
186
  read_options: read_options,
187
187
  keys: keys
188
- )
188
+ }.delete_if { |_, v| v.nil? })
189
189
  @lookup.call(req, options)
190
190
  end
191
191
 
@@ -210,17 +210,17 @@ module Google
210
210
  # @return [Google::Datastore::V1::RunQueryResponse]
211
211
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
212
212
  # @example
213
- # require "google/cloud/datastore/v1/datastore_api"
213
+ # require "google/cloud/datastore/v1/datastore_client"
214
214
  #
215
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
215
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
216
216
  # PartitionId = Google::Datastore::V1::PartitionId
217
217
  # ReadOptions = Google::Datastore::V1::ReadOptions
218
218
  #
219
- # datastore_api = DatastoreApi.new
219
+ # datastore_client = DatastoreClient.new
220
220
  # project_id = ''
221
221
  # partition_id = PartitionId.new
222
222
  # read_options = ReadOptions.new
223
- # response = datastore_api.run_query(project_id, partition_id, read_options)
223
+ # response = datastore_client.run_query(project_id, partition_id, read_options)
224
224
 
225
225
  def run_query \
226
226
  project_id,
@@ -229,13 +229,13 @@ module Google
229
229
  query: nil,
230
230
  gql_query: nil,
231
231
  options: nil
232
- req = Google::Datastore::V1::RunQueryRequest.new(
232
+ req = Google::Datastore::V1::RunQueryRequest.new({
233
233
  project_id: project_id,
234
234
  partition_id: partition_id,
235
- read_options: read_options
236
- )
237
- req.query = query unless query.nil?
238
- req.gql_query = gql_query unless gql_query.nil?
235
+ read_options: read_options,
236
+ query: query,
237
+ gql_query: gql_query
238
+ }.delete_if { |_, v| v.nil? })
239
239
  @run_query.call(req, options)
240
240
  end
241
241
 
@@ -249,20 +249,20 @@ module Google
249
249
  # @return [Google::Datastore::V1::BeginTransactionResponse]
250
250
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
251
251
  # @example
252
- # require "google/cloud/datastore/v1/datastore_api"
252
+ # require "google/cloud/datastore/v1/datastore_client"
253
253
  #
254
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
254
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
255
255
  #
256
- # datastore_api = DatastoreApi.new
256
+ # datastore_client = DatastoreClient.new
257
257
  # project_id = ''
258
- # response = datastore_api.begin_transaction(project_id)
258
+ # response = datastore_client.begin_transaction(project_id)
259
259
 
260
260
  def begin_transaction \
261
261
  project_id,
262
262
  options: nil
263
- req = Google::Datastore::V1::BeginTransactionRequest.new(
263
+ req = Google::Datastore::V1::BeginTransactionRequest.new({
264
264
  project_id: project_id
265
- )
265
+ }.delete_if { |_, v| v.nil? })
266
266
  @begin_transaction.call(req, options)
267
267
  end
268
268
 
@@ -297,16 +297,16 @@ module Google
297
297
  # @return [Google::Datastore::V1::CommitResponse]
298
298
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
299
299
  # @example
300
- # require "google/cloud/datastore/v1/datastore_api"
300
+ # require "google/cloud/datastore/v1/datastore_client"
301
301
  #
302
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
302
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
303
303
  # Mode = Google::Datastore::V1::CommitRequest::Mode
304
304
  #
305
- # datastore_api = DatastoreApi.new
305
+ # datastore_client = DatastoreClient.new
306
306
  # project_id = ''
307
307
  # mode = Mode::MODE_UNSPECIFIED
308
308
  # mutations = []
309
- # response = datastore_api.commit(project_id, mode, mutations)
309
+ # response = datastore_client.commit(project_id, mode, mutations)
310
310
 
311
311
  def commit \
312
312
  project_id,
@@ -314,12 +314,12 @@ module Google
314
314
  mutations,
315
315
  transaction: nil,
316
316
  options: nil
317
- req = Google::Datastore::V1::CommitRequest.new(
317
+ req = Google::Datastore::V1::CommitRequest.new({
318
318
  project_id: project_id,
319
319
  mode: mode,
320
- mutations: mutations
321
- )
322
- req.transaction = transaction unless transaction.nil?
320
+ mutations: mutations,
321
+ transaction: transaction
322
+ }.delete_if { |_, v| v.nil? })
323
323
  @commit.call(req, options)
324
324
  end
325
325
 
@@ -336,23 +336,23 @@ module Google
336
336
  # @return [Google::Datastore::V1::RollbackResponse]
337
337
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
338
338
  # @example
339
- # require "google/cloud/datastore/v1/datastore_api"
339
+ # require "google/cloud/datastore/v1/datastore_client"
340
340
  #
341
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
341
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
342
342
  #
343
- # datastore_api = DatastoreApi.new
343
+ # datastore_client = DatastoreClient.new
344
344
  # project_id = ''
345
345
  # transaction = ''
346
- # response = datastore_api.rollback(project_id, transaction)
346
+ # response = datastore_client.rollback(project_id, transaction)
347
347
 
348
348
  def rollback \
349
349
  project_id,
350
350
  transaction,
351
351
  options: nil
352
- req = Google::Datastore::V1::RollbackRequest.new(
352
+ req = Google::Datastore::V1::RollbackRequest.new({
353
353
  project_id: project_id,
354
354
  transaction: transaction
355
- )
355
+ }.delete_if { |_, v| v.nil? })
356
356
  @rollback.call(req, options)
357
357
  end
358
358
 
@@ -370,23 +370,23 @@ module Google
370
370
  # @return [Google::Datastore::V1::AllocateIdsResponse]
371
371
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
372
372
  # @example
373
- # require "google/cloud/datastore/v1/datastore_api"
373
+ # require "google/cloud/datastore/v1/datastore_client"
374
374
  #
375
- # DatastoreApi = Google::Cloud::Datastore::V1::DatastoreApi
375
+ # DatastoreClient = Google::Cloud::Datastore::V1::DatastoreClient
376
376
  #
377
- # datastore_api = DatastoreApi.new
377
+ # datastore_client = DatastoreClient.new
378
378
  # project_id = ''
379
379
  # keys = []
380
- # response = datastore_api.allocate_ids(project_id, keys)
380
+ # response = datastore_client.allocate_ids(project_id, keys)
381
381
 
382
382
  def allocate_ids \
383
383
  project_id,
384
384
  keys,
385
385
  options: nil
386
- req = Google::Datastore::V1::AllocateIdsRequest.new(
386
+ req = Google::Datastore::V1::AllocateIdsRequest.new({
387
387
  project_id: project_id,
388
388
  keys: keys
389
- )
389
+ }.delete_if { |_, v| v.nil? })
390
390
  @allocate_ids.call(req, options)
391
391
  end
392
392
  end
@@ -0,0 +1,240 @@
1
+ # Copyright 2016 Google Inc. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Datastore
17
+ module V1
18
+ # The request for Datastore::Lookup.
19
+ # @!attribute [rw] project_id
20
+ # @return [String]
21
+ # The ID of the project against which to make the request.
22
+ # @!attribute [rw] read_options
23
+ # @return [Google::Datastore::V1::ReadOptions]
24
+ # The options for this lookup request.
25
+ # @!attribute [rw] keys
26
+ # @return [Array<Google::Datastore::V1::Key>]
27
+ # Keys of entities to look up.
28
+ class LookupRequest; end
29
+
30
+ # The response for Datastore::Lookup.
31
+ # @!attribute [rw] found
32
+ # @return [Array<Google::Datastore::V1::EntityResult>]
33
+ # Entities found as +ResultType.FULL+ entities. The order of results in this
34
+ # field is undefined and has no relation to the order of the keys in the
35
+ # input.
36
+ # @!attribute [rw] missing
37
+ # @return [Array<Google::Datastore::V1::EntityResult>]
38
+ # Entities not found as +ResultType.KEY_ONLY+ entities. The order of results
39
+ # in this field is undefined and has no relation to the order of the keys
40
+ # in the input.
41
+ # @!attribute [rw] deferred
42
+ # @return [Array<Google::Datastore::V1::Key>]
43
+ # A list of keys that were not looked up due to resource constraints. The
44
+ # order of results in this field is undefined and has no relation to the
45
+ # order of the keys in the input.
46
+ class LookupResponse; end
47
+
48
+ # The request for Datastore::RunQuery.
49
+ # @!attribute [rw] project_id
50
+ # @return [String]
51
+ # The ID of the project against which to make the request.
52
+ # @!attribute [rw] partition_id
53
+ # @return [Google::Datastore::V1::PartitionId]
54
+ # Entities are partitioned into subsets, identified by a partition ID.
55
+ # Queries are scoped to a single partition.
56
+ # This partition ID is normalized with the standard default context
57
+ # partition ID.
58
+ # @!attribute [rw] read_options
59
+ # @return [Google::Datastore::V1::ReadOptions]
60
+ # The options for this query.
61
+ # @!attribute [rw] query
62
+ # @return [Google::Datastore::V1::Query]
63
+ # The query to run.
64
+ # @!attribute [rw] gql_query
65
+ # @return [Google::Datastore::V1::GqlQuery]
66
+ # The GQL query to run.
67
+ class RunQueryRequest; end
68
+
69
+ # The response for Datastore::RunQuery.
70
+ # @!attribute [rw] batch
71
+ # @return [Google::Datastore::V1::QueryResultBatch]
72
+ # A batch of query results (always present).
73
+ # @!attribute [rw] query
74
+ # @return [Google::Datastore::V1::Query]
75
+ # The parsed form of the +GqlQuery+ from the request, if it was set.
76
+ class RunQueryResponse; end
77
+
78
+ # The request for Datastore::BeginTransaction.
79
+ # @!attribute [rw] project_id
80
+ # @return [String]
81
+ # The ID of the project against which to make the request.
82
+ class BeginTransactionRequest; end
83
+
84
+ # The response for Datastore::BeginTransaction.
85
+ # @!attribute [rw] transaction
86
+ # @return [String]
87
+ # The transaction identifier (always present).
88
+ class BeginTransactionResponse; end
89
+
90
+ # The request for Datastore::Rollback.
91
+ # @!attribute [rw] project_id
92
+ # @return [String]
93
+ # The ID of the project against which to make the request.
94
+ # @!attribute [rw] transaction
95
+ # @return [String]
96
+ # The transaction identifier, returned by a call to
97
+ # Datastore::BeginTransaction.
98
+ class RollbackRequest; end
99
+
100
+ # The response for Datastore::Rollback.
101
+ # (an empty message).
102
+ class RollbackResponse; end
103
+
104
+ # The request for Datastore::Commit.
105
+ # @!attribute [rw] project_id
106
+ # @return [String]
107
+ # The ID of the project against which to make the request.
108
+ # @!attribute [rw] mode
109
+ # @return [Google::Datastore::V1::CommitRequest::Mode]
110
+ # The type of commit to perform. Defaults to +TRANSACTIONAL+.
111
+ # @!attribute [rw] transaction
112
+ # @return [String]
113
+ # The identifier of the transaction associated with the commit. A
114
+ # transaction identifier is returned by a call to
115
+ # Datastore::BeginTransaction.
116
+ # @!attribute [rw] mutations
117
+ # @return [Array<Google::Datastore::V1::Mutation>]
118
+ # The mutations to perform.
119
+ #
120
+ # When mode is +TRANSACTIONAL+, mutations affecting a single entity are
121
+ # applied in order. The following sequences of mutations affecting a single
122
+ # entity are not permitted in a single +Commit+ request:
123
+ #
124
+ # - +insert+ followed by +insert+
125
+ # - +update+ followed by +insert+
126
+ # - +upsert+ followed by +insert+
127
+ # - +delete+ followed by +update+
128
+ #
129
+ # When mode is +NON_TRANSACTIONAL+, no two mutations may affect a single
130
+ # entity.
131
+ class CommitRequest
132
+ # The modes available for commits.
133
+ module Mode
134
+ # Unspecified. This value must not be used.
135
+ MODE_UNSPECIFIED = 0
136
+
137
+ # Transactional: The mutations are either all applied, or none are applied.
138
+ # Learn about transactions {here}[https://cloud.google.com/datastore/docs/concepts/transactions].
139
+ TRANSACTIONAL = 1
140
+
141
+ # Non-transactional: The mutations may not apply as all or none.
142
+ NON_TRANSACTIONAL = 2
143
+ end
144
+ end
145
+
146
+ # The response for Datastore::Commit.
147
+ # @!attribute [rw] mutation_results
148
+ # @return [Array<Google::Datastore::V1::MutationResult>]
149
+ # The result of performing the mutations.
150
+ # The i-th mutation result corresponds to the i-th mutation in the request.
151
+ # @!attribute [rw] index_updates
152
+ # @return [Integer]
153
+ # The number of index entries updated during the commit, or zero if none were
154
+ # updated.
155
+ class CommitResponse; end
156
+
157
+ # The request for Datastore::AllocateIds.
158
+ # @!attribute [rw] project_id
159
+ # @return [String]
160
+ # The ID of the project against which to make the request.
161
+ # @!attribute [rw] keys
162
+ # @return [Array<Google::Datastore::V1::Key>]
163
+ # A list of keys with incomplete key paths for which to allocate IDs.
164
+ # No key may be reserved/read-only.
165
+ class AllocateIdsRequest; end
166
+
167
+ # The response for Datastore::AllocateIds.
168
+ # @!attribute [rw] keys
169
+ # @return [Array<Google::Datastore::V1::Key>]
170
+ # The keys specified in the request (in the same order), each with
171
+ # its key path completed with a newly allocated ID.
172
+ class AllocateIdsResponse; end
173
+
174
+ # A mutation to apply to an entity.
175
+ # @!attribute [rw] insert
176
+ # @return [Google::Datastore::V1::Entity]
177
+ # The entity to insert. The entity must not already exist.
178
+ # The entity key's final path element may be incomplete.
179
+ # @!attribute [rw] update
180
+ # @return [Google::Datastore::V1::Entity]
181
+ # The entity to update. The entity must already exist.
182
+ # Must have a complete key path.
183
+ # @!attribute [rw] upsert
184
+ # @return [Google::Datastore::V1::Entity]
185
+ # The entity to upsert. The entity may or may not already exist.
186
+ # The entity key's final path element may be incomplete.
187
+ # @!attribute [rw] delete
188
+ # @return [Google::Datastore::V1::Key]
189
+ # The key of the entity to delete. The entity may or may not already exist.
190
+ # Must have a complete key path and must not be reserved/read-only.
191
+ # @!attribute [rw] base_version
192
+ # @return [Integer]
193
+ # The version of the entity that this mutation is being applied to. If this
194
+ # does not match the current version on the server, the mutation conflicts.
195
+ class Mutation; end
196
+
197
+ # The result of applying a mutation.
198
+ # @!attribute [rw] key
199
+ # @return [Google::Datastore::V1::Key]
200
+ # The automatically allocated key.
201
+ # Set only when the mutation allocated a key.
202
+ # @!attribute [rw] version
203
+ # @return [Integer]
204
+ # The version of the entity on the server after processing the mutation. If
205
+ # the mutation doesn't change anything on the server, then the version will
206
+ # be the version of the current entity or, if no entity is present, a version
207
+ # that is strictly greater than the version of any previous entity and less
208
+ # than the version of any possible future entity.
209
+ # @!attribute [rw] conflict_detected
210
+ # @return [true, false]
211
+ # Whether a conflict was detected for this mutation. Always false when a
212
+ # conflict detection strategy field is not set in the mutation.
213
+ class MutationResult; end
214
+
215
+ # The options shared by read requests.
216
+ # @!attribute [rw] read_consistency
217
+ # @return [Google::Datastore::V1::ReadOptions::ReadConsistency]
218
+ # The non-transactional read consistency to use.
219
+ # Cannot be set to +STRONG+ for global queries.
220
+ # @!attribute [rw] transaction
221
+ # @return [String]
222
+ # The identifier of the transaction in which to read. A
223
+ # transaction identifier is returned by a call to
224
+ # Datastore::BeginTransaction.
225
+ class ReadOptions
226
+ # The possible values for read consistencies.
227
+ module ReadConsistency
228
+ # Unspecified. This value must not be used.
229
+ READ_CONSISTENCY_UNSPECIFIED = 0
230
+
231
+ # Strong consistency.
232
+ STRONG = 1
233
+
234
+ # Eventual consistency.
235
+ EVENTUAL = 2
236
+ end
237
+ end
238
+ end
239
+ end
240
+ end