Debian Codegraph @

third_party/googleapis/google/datastore/v1beta3/datastore.proto

raw
1 // Copyright 2016 Google Inc.
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 syntax = "proto3";
16
17 package google.datastore.v1beta3;
18
19 import "google/api/annotations.proto";
20 import "google/datastore/v1beta3/entity.proto";
21 import "google/datastore/v1beta3/query.proto";
22
23 option csharp_namespace = "Google.Cloud.Datastore.V1Beta3";
24 option go_package = "google.golang.org/genproto/googleapis/datastore/v1beta3;datastore";
25 option java_multiple_files = true;
26 option java_outer_classname = "DatastoreProto";
27 option java_package = "com.google.datastore.v1beta3";
28
29
30 // Each RPC normalizes the partition IDs of the keys in its input entities,
31 // and always returns entities with keys with normalized partition IDs.
32 // This applies to all keys and entities, including those in values, except keys
33 // with both an empty path and an empty or unset partition ID. Normalization of
34 // input keys sets the project ID (if not already set) to the project ID from
35 // the request.
36 //
37 service Datastore {
38 // Looks up entities by key.
39 rpc Lookup(LookupRequest) returns (LookupResponse) {
40 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:lookup" body: "*" };
41 }
42
43 // Queries for entities.
44 rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) {
45 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:runQuery" body: "*" };
46 }
47
48 // Begins a new transaction.
49 rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionResponse) {
50 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:beginTransaction" body: "*" };
51 }
52
53 // Commits a transaction, optionally creating, deleting or modifying some
54 // entities.
55 rpc Commit(CommitRequest) returns (CommitResponse) {
56 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:commit" body: "*" };
57 }
58
59 // Rolls back a transaction.
60 rpc Rollback(RollbackRequest) returns (RollbackResponse) {
61 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:rollback" body: "*" };
62 }
63
64 // Allocates IDs for the given keys, which is useful for referencing an entity
65 // before it is inserted.
66 rpc AllocateIds(AllocateIdsRequest) returns (AllocateIdsResponse) {
67 option (google.api.http) = { post: "/v1beta3/projects/{project_id}:allocateIds" body: "*" };
68 }
69 }
70
71 // The request for [Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup].
72 message LookupRequest {
73 // The ID of the project against which to make the request.
74 string project_id = 8;
75
76 // The options for this lookup request.
77 ReadOptions read_options = 1;
78
79 // Keys of entities to look up.
80 repeated Key keys = 3;
81 }
82
83 // The response for [Datastore.Lookup][google.datastore.v1beta3.Datastore.Lookup].
84 message LookupResponse {
85 // Entities found as `ResultType.FULL` entities. The order of results in this
86 // field is undefined and has no relation to the order of the keys in the
87 // input.
88 repeated EntityResult found = 1;
89
90 // Entities not found as `ResultType.KEY_ONLY` entities. The order of results
91 // in this field is undefined and has no relation to the order of the keys
92 // in the input.
93 repeated EntityResult missing = 2;
94
95 // A list of keys that were not looked up due to resource constraints. The
96 // order of results in this field is undefined and has no relation to the
97 // order of the keys in the input.
98 repeated Key deferred = 3;
99 }
100
101 // The request for [Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery].
102 message RunQueryRequest {
103 // The ID of the project against which to make the request.
104 string project_id = 8;
105
106 // Entities are partitioned into subsets, identified by a partition ID.
107 // Queries are scoped to a single partition.
108 // This partition ID is normalized with the standard default context
109 // partition ID.
110 PartitionId partition_id = 2;
111
112 // The options for this query.
113 ReadOptions read_options = 1;
114
115 // The type of query.
116 oneof query_type {
117 // The query to run.
118 Query query = 3;
119
120 // The GQL query to run.
121 GqlQuery gql_query = 7;
122 }
123 }
124
125 // The response for [Datastore.RunQuery][google.datastore.v1beta3.Datastore.RunQuery].
126 message RunQueryResponse {
127 // A batch of query results (always present).
128 QueryResultBatch batch = 1;
129
130 // The parsed form of the `GqlQuery` from the request, if it was set.
131 Query query = 2;
132 }
133
134 // The request for [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
135 message BeginTransactionRequest {
136 // The ID of the project against which to make the request.
137 string project_id = 8;
138 }
139
140 // The response for [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
141 message BeginTransactionResponse {
142 // The transaction identifier (always present).
143 bytes transaction = 1;
144 }
145
146 // The request for [Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback].
147 message RollbackRequest {
148 // The ID of the project against which to make the request.
149 string project_id = 8;
150
151 // The transaction identifier, returned by a call to
152 // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
153 bytes transaction = 1;
154 }
155
156 // The response for [Datastore.Rollback][google.datastore.v1beta3.Datastore.Rollback].
157 // (an empty message).
158 message RollbackResponse {
159
160 }
161
162 // The request for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
163 message CommitRequest {
164 // The modes available for commits.
165 enum Mode {
166 // Unspecified. This value must not be used.
167 MODE_UNSPECIFIED = 0;
168
169 // Transactional: The mutations are either all applied, or none are applied.
170 // Learn about transactions [here](https://cloud.google.com/datastore/docs/concepts/transactions).
171 TRANSACTIONAL = 1;
172
173 // Non-transactional: The mutations may not apply as all or none.
174 NON_TRANSACTIONAL = 2;
175 }
176
177 // The ID of the project against which to make the request.
178 string project_id = 8;
179
180 // The type of commit to perform. Defaults to `TRANSACTIONAL`.
181 Mode mode = 5;
182
183 // Must be set when mode is `TRANSACTIONAL`.
184 oneof transaction_selector {
185 // The identifier of the transaction associated with the commit. A
186 // transaction identifier is returned by a call to
187 // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
188 bytes transaction = 1;
189 }
190
191 // The mutations to perform.
192 //
193 // When mode is `TRANSACTIONAL`, mutations affecting a single entity are
194 // applied in order. The following sequences of mutations affecting a single
195 // entity are not permitted in a single `Commit` request:
196 //
197 // - `insert` followed by `insert`
198 // - `update` followed by `insert`
199 // - `upsert` followed by `insert`
200 // - `delete` followed by `update`
201 //
202 // When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
203 // entity.
204 repeated Mutation mutations = 6;
205 }
206
207 // The response for [Datastore.Commit][google.datastore.v1beta3.Datastore.Commit].
208 message CommitResponse {
209 // The result of performing the mutations.
210 // The i-th mutation result corresponds to the i-th mutation in the request.
211 repeated MutationResult mutation_results = 3;
212
213 // The number of index entries updated during the commit, or zero if none were
214 // updated.
215 int32 index_updates = 4;
216 }
217
218 // The request for [Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds].
219 message AllocateIdsRequest {
220 // The ID of the project against which to make the request.
221 string project_id = 8;
222
223 // A list of keys with incomplete key paths for which to allocate IDs.
224 // No key may be reserved/read-only.
225 repeated Key keys = 1;
226 }
227
228 // The response for [Datastore.AllocateIds][google.datastore.v1beta3.Datastore.AllocateIds].
229 message AllocateIdsResponse {
230 // The keys specified in the request (in the same order), each with
231 // its key path completed with a newly allocated ID.
232 repeated Key keys = 1;
233 }
234
235 // A mutation to apply to an entity.
236 message Mutation {
237 // The mutation operation.
238 //
239 // For `insert`, `update`, and `upsert`:
240 // - The entity's key must not be reserved/read-only.
241 // - No property in the entity may have a reserved name,
242 // not even a property in an entity in a value.
243 // - No value in the entity may have meaning 18,
244 // not even a value in an entity in another value.
245 oneof operation {
246 // The entity to insert. The entity must not already exist.
247 // The entity key's final path element may be incomplete.
248 Entity insert = 4;
249
250 // The entity to update. The entity must already exist.
251 // Must have a complete key path.
252 Entity update = 5;
253
254 // The entity to upsert. The entity may or may not already exist.
255 // The entity key's final path element may be incomplete.
256 Entity upsert = 6;
257
258 // The key of the entity to delete. The entity may or may not already exist.
259 // Must have a complete key path and must not be reserved/read-only.
260 Key delete = 7;
261 }
262
263 // When set, the server will detect whether or not this mutation conflicts
264 // with the current version of the entity on the server. Conflicting mutations
265 // are not applied, and are marked as such in MutationResult.
266 oneof conflict_detection_strategy {
267 // The version of the entity that this mutation is being applied to. If this
268 // does not match the current version on the server, the mutation conflicts.
269 int64 base_version = 8;
270 }
271 }
272
273 // The result of applying a mutation.
274 message MutationResult {
275 // The automatically allocated key.
276 // Set only when the mutation allocated a key.
277 Key key = 3;
278
279 // The version of the entity on the server after processing the mutation. If
280 // the mutation doesn't change anything on the server, then the version will
281 // be the version of the current entity or, if no entity is present, a version
282 // that is strictly greater than the version of any previous entity and less
283 // than the version of any possible future entity.
284 int64 version = 4;
285
286 // Whether a conflict was detected for this mutation. Always false when a
287 // conflict detection strategy field is not set in the mutation.
288 bool conflict_detected = 5;
289 }
290
291 // The options shared by read requests.
292 message ReadOptions {
293 // The possible values for read consistencies.
294 enum ReadConsistency {
295 // Unspecified. This value must not be used.
296 READ_CONSISTENCY_UNSPECIFIED = 0;
297
298 // Strong consistency.
299 STRONG = 1;
300
301 // Eventual consistency.
302 EVENTUAL = 2;
303 }
304
305 // If not specified, lookups and ancestor queries default to
306 // `read_consistency`=`STRONG`, global queries default to
307 // `read_consistency`=`EVENTUAL`.
308 oneof consistency_type {
309 // The non-transactional read consistency to use.
310 // Cannot be set to `STRONG` for global queries.
311 ReadConsistency read_consistency = 1;
312
313 // The identifier of the transaction in which to read. A
314 // transaction identifier is returned by a call to
315 // [Datastore.BeginTransaction][google.datastore.v1beta3.Datastore.BeginTransaction].
316 bytes transaction = 2;
317 }
318 }