1- // Copyright (c) 2015, Google Inc.
1+ // Copyright 2016 Google Inc.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
1414
1515syntax = "proto3" ;
1616
17- package google.datastore.v1beta3 ;
17+ package google.datastore.v1 ;
1818
1919import "google/api/annotations.proto" ;
20- import "google/datastore/v1beta3 /entity.proto" ;
21- import "google/datastore/v1beta3 /query.proto" ;
20+ import "google/datastore/v1 /entity.proto" ;
21+ import "google/datastore/v1 /query.proto" ;
2222
2323option java_multiple_files = true ;
2424option java_outer_classname = "DatastoreProto" ;
25- option java_package = "com.google.datastore.v1beta3 " ;
25+ option java_package = "com.google.datastore.v1 " ;
2626
2727
2828// Each RPC normalizes the partition IDs of the keys in its input entities,
@@ -32,42 +32,41 @@ option java_package = "com.google.datastore.v1beta3";
3232// input keys sets the project ID (if not already set) to the project ID from
3333// the request.
3434//
35- //
3635service Datastore {
3736 // Looks up entities by key.
3837 rpc Lookup (LookupRequest ) returns (LookupResponse ) {
39- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:lookup" body : "*" };
38+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:lookup" body : "*" };
4039 }
4140
4241 // Queries for entities.
4342 rpc RunQuery (RunQueryRequest ) returns (RunQueryResponse ) {
44- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:runQuery" body : "*" };
43+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:runQuery" body : "*" };
4544 }
4645
4746 // Begins a new transaction.
4847 rpc BeginTransaction (BeginTransactionRequest ) returns (BeginTransactionResponse ) {
49- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:beginTransaction" body : "*" };
48+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:beginTransaction" body : "*" };
5049 }
5150
5251 // Commits a transaction, optionally creating, deleting or modifying some
5352 // entities.
5453 rpc Commit (CommitRequest ) returns (CommitResponse ) {
55- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:commit" body : "*" };
54+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:commit" body : "*" };
5655 }
5756
5857 // Rolls back a transaction.
5958 rpc Rollback (RollbackRequest ) returns (RollbackResponse ) {
60- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:rollback" body : "*" };
59+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:rollback" body : "*" };
6160 }
6261
6362 // Allocates IDs for the given keys, which is useful for referencing an entity
6463 // before it is inserted.
6564 rpc AllocateIds (AllocateIdsRequest ) returns (AllocateIdsResponse ) {
66- option (google.api.http ) = { post : "/v1beta3 /projects/{project_id}:allocateIds" body : "*" };
65+ option (google.api.http ) = { post : "/v1 /projects/{project_id}:allocateIds" body : "*" };
6766 }
6867}
6968
70- // The request for [google.datastore.v1beta3. Datastore.Lookup][google.datastore.v1beta3 .Datastore.Lookup].
69+ // The request for [Datastore.Lookup][google.datastore.v1 .Datastore.Lookup].
7170message LookupRequest {
7271 // The ID of the project against which to make the request.
7372 string project_id = 8 ;
@@ -79,7 +78,7 @@ message LookupRequest {
7978 repeated Key keys = 3 ;
8079}
8180
82- // The response for [google.datastore.v1beta3. Datastore.Lookup][google.datastore.v1beta3 .Datastore.Lookup].
81+ // The response for [Datastore.Lookup][google.datastore.v1 .Datastore.Lookup].
8382message LookupResponse {
8483 // Entities found as `ResultType.FULL` entities. The order of results in this
8584 // field is undefined and has no relation to the order of the keys in the
@@ -97,7 +96,7 @@ message LookupResponse {
9796 repeated Key deferred = 3 ;
9897}
9998
100- // The request for [google.datastore.v1beta3. Datastore.RunQuery][google.datastore.v1beta3 .Datastore.RunQuery].
99+ // The request for [Datastore.RunQuery][google.datastore.v1 .Datastore.RunQuery].
101100message RunQueryRequest {
102101 // The ID of the project against which to make the request.
103102 string project_id = 8 ;
@@ -121,7 +120,7 @@ message RunQueryRequest {
121120 }
122121}
123122
124- // The response for [google.datastore.v1beta3. Datastore.RunQuery][google.datastore.v1beta3 .Datastore.RunQuery].
123+ // The response for [Datastore.RunQuery][google.datastore.v1 .Datastore.RunQuery].
125124message RunQueryResponse {
126125 // A batch of query results (always present).
127126 QueryResultBatch batch = 1 ;
@@ -130,35 +129,35 @@ message RunQueryResponse {
130129 Query query = 2 ;
131130}
132131
133- // The request for [google.datastore.v1beta3. Datastore.BeginTransaction][google.datastore.v1beta3 .Datastore.BeginTransaction].
132+ // The request for [Datastore.BeginTransaction][google.datastore.v1 .Datastore.BeginTransaction].
134133message BeginTransactionRequest {
135134 // The ID of the project against which to make the request.
136135 string project_id = 8 ;
137136}
138137
139- // The response for [google.datastore.v1beta3. Datastore.BeginTransaction][google.datastore.v1beta3 .Datastore.BeginTransaction].
138+ // The response for [Datastore.BeginTransaction][google.datastore.v1 .Datastore.BeginTransaction].
140139message BeginTransactionResponse {
141140 // The transaction identifier (always present).
142141 bytes transaction = 1 ;
143142}
144143
145- // The request for [google.datastore.v1beta3. Datastore.Rollback][google.datastore.v1beta3 .Datastore.Rollback].
144+ // The request for [Datastore.Rollback][google.datastore.v1 .Datastore.Rollback].
146145message RollbackRequest {
147146 // The ID of the project against which to make the request.
148147 string project_id = 8 ;
149148
150149 // The transaction identifier, returned by a call to
151- // [google.datastore.v1beta3. Datastore.BeginTransaction][google.datastore.v1beta3 .Datastore.BeginTransaction].
150+ // [Datastore.BeginTransaction][google.datastore.v1 .Datastore.BeginTransaction].
152151 bytes transaction = 1 ;
153152}
154153
155- // The response for [google.datastore.v1beta3. Datastore.Rollback][google.datastore.v1beta3 .Datastore.Rollback]
154+ // The response for [Datastore.Rollback][google.datastore.v1 .Datastore.Rollback].
156155// (an empty message).
157156message RollbackResponse {
158157
159158}
160159
161- // The request for [google.datastore.v1beta3. Datastore.Commit][google.datastore.v1beta3 .Datastore.Commit].
160+ // The request for [Datastore.Commit][google.datastore.v1 .Datastore.Commit].
162161message CommitRequest {
163162 // The modes available for commits.
164163 enum Mode {
@@ -183,7 +182,7 @@ message CommitRequest {
183182 oneof transaction_selector {
184183 // The identifier of the transaction associated with the commit. A
185184 // transaction identifier is returned by a call to
186- // [BeginTransaction][google.datastore.v1beta3 .Datastore.BeginTransaction].
185+ // [Datastore. BeginTransaction][google.datastore.v1 .Datastore.BeginTransaction].
187186 bytes transaction = 1 ;
188187 }
189188
@@ -203,7 +202,7 @@ message CommitRequest {
203202 repeated Mutation mutations = 6 ;
204203}
205204
206- // The response for [google.datastore.v1beta3. Datastore.Commit][google.datastore.v1beta3 .Datastore.Commit].
205+ // The response for [Datastore.Commit][google.datastore.v1 .Datastore.Commit].
207206message CommitResponse {
208207 // The result of performing the mutations.
209208 // The i-th mutation result corresponds to the i-th mutation in the request.
@@ -214,7 +213,7 @@ message CommitResponse {
214213 int32 index_updates = 4 ;
215214}
216215
217- // The request for [google.datastore.v1beta3. Datastore.AllocateIds][google.datastore.v1beta3 .Datastore.AllocateIds].
216+ // The request for [Datastore.AllocateIds][google.datastore.v1 .Datastore.AllocateIds].
218217message AllocateIdsRequest {
219218 // The ID of the project against which to make the request.
220219 string project_id = 8 ;
@@ -224,7 +223,7 @@ message AllocateIdsRequest {
224223 repeated Key keys = 1 ;
225224}
226225
227- // The response for [google.datastore.v1beta3. Datastore.AllocateIds][google.datastore.v1beta3 .Datastore.AllocateIds].
226+ // The response for [Datastore.AllocateIds][google.datastore.v1 .Datastore.AllocateIds].
228227message AllocateIdsResponse {
229228 // The keys specified in the request (in the same order), each with
230229 // its key path completed with a newly allocated ID.
@@ -258,13 +257,33 @@ message Mutation {
258257 // Must have a complete key path and must not be reserved/read-only.
259258 Key delete = 7 ;
260259 }
260+
261+ // When set, the server will detect whether or not this mutation conflicts
262+ // with the current version of the entity on the server. Conflicting mutations
263+ // are not applied, and are marked as such in MutationResult.
264+ oneof conflict_detection_strategy {
265+ // The version of the entity that this mutation is being applied to. If this
266+ // does not match the current version on the server, the mutation conflicts.
267+ int64 base_version = 8 ;
268+ }
261269}
262270
263271// The result of applying a mutation.
264272message MutationResult {
265273 // The automatically allocated key.
266274 // Set only when the mutation allocated a key.
267275 Key key = 3 ;
276+
277+ // The version of the entity on the server after processing the mutation. If
278+ // the mutation doesn't change anything on the server, then the version will
279+ // be the version of the current entity or, if no entity is present, a version
280+ // that is strictly greater than the version of any previous entity and less
281+ // than the version of any possible future entity.
282+ int64 version = 4 ;
283+
284+ // Whether a conflict was detected for this mutation. Always false when a
285+ // conflict detection strategy field is not set in the mutation.
286+ bool conflict_detected = 5 ;
268287}
269288
270289// The options shared by read requests.
@@ -289,7 +308,9 @@ message ReadOptions {
289308 // Cannot be set to `STRONG` for global queries.
290309 ReadConsistency read_consistency = 1 ;
291310
292- // The transaction in which to read.
311+ // The identifier of the transaction in which to read. A
312+ // transaction identifier is returned by a call to
313+ // [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
293314 bytes transaction = 2 ;
294315 }
295316}
0 commit comments