Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Side by Side Diff: pkg/appengine/lib/src/protobuf_api/external/datastore_v1.proto

Issue 804973002: Add appengine/gcloud/mustache dependencies. (Closed) Base URL: git@github.com:dart-lang/pub-dartlang-dart.git@master
Patch Set: Added AUTHORS/LICENSE/PATENTS files Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2013 Google Inc. All Rights Reserved.
2 //
3 // The datastore v1 service proto definitions
4
5 syntax = "proto2";
6
7 package api.services.datastore;
8 option java_package = "com.google.api.services.datastore";
9
10
11 // An identifier for a particular subset of entities.
12 //
13 // Entities are partitioned into various subsets, each used by different
14 // datasets and different namespaces within a dataset and so forth.
15 //
16 // All input partition IDs are normalized before use.
17 // A partition ID is normalized as follows:
18 // If the partition ID is unset or is set to an empty partition ID, replace it
19 // with the context partition ID.
20 // Otherwise, if the partition ID has no dataset ID, assign it the context
21 // partition ID's dataset ID.
22 // Unless otherwise documented, the context partition ID has the dataset ID set
23 // to the context dataset ID and no other partition dimension set.
24 //
25 // A partition ID is empty if all of its fields are unset.
26 //
27 // Partition dimension:
28 // A dimension may be unset.
29 // A dimension's value must never be "".
30 // A dimension's value must match [A-Za-z\d\.\-_]{1,100}
31 // If the value of any dimension matches regex "__.*__",
32 // the partition is reserved/read-only.
33 // A reserved/read-only partition ID is forbidden in certain documented contexts .
34 //
35 // Dataset ID:
36 // A dataset id's value must never be "".
37 // A dataset id's value must match
38 // ([a-z\d\-]{1,100}~)?([a-z\d][a-z\d\-\.]{0,99}:)?([a-z\d][a-z\d\-]{0,99}
39 message PartitionId {
40 // The dataset ID.
41 optional string dataset_id = 3;
42 // The namespace.
43 optional string namespace = 4;
44 }
45
46 // A unique identifier for an entity.
47 // If a key's partition id or any of its path kinds or names are
48 // reserved/read-only, the key is reserved/read-only.
49 // A reserved/read-only key is forbidden in certain documented contexts.
50 message Key {
51 // Entities are partitioned into subsets, currently identified by a dataset
52 // (usually implicitly specified by the project) and namespace ID.
53 // Queries are scoped to a single partition.
54 optional PartitionId partition_id = 1;
55
56 // A (kind, ID/name) pair used to construct a key path.
57 //
58 // At most one of name or ID may be set.
59 // If either is set, the element is complete.
60 // If neither is set, the element is incomplete.
61 message PathElement {
62 // The kind of the entity.
63 // A kind matching regex "__.*__" is reserved/read-only.
64 // A kind must not contain more than 500 characters.
65 // Cannot be "".
66 required string kind = 1;
67 // The ID of the entity.
68 // Never equal to zero. Values less than zero are discouraged and will not
69 // be supported in the future.
70 optional int64 id = 2;
71 // The name of the entity.
72 // A name matching regex "__.*__" is reserved/read-only.
73 // A name must not be more than 500 characters.
74 // Cannot be "".
75 optional string name = 3;
76 }
77
78 // The entity path.
79 // An entity path consists of one or more elements composed of a kind and a
80 // string or numerical identifier, which identify entities. The first
81 // element identifies a <em>root entity</em>, the second element identifies
82 // a <em>child</em> of the root entity, the third element a child of the
83 // second entity, and so forth. The entities identified by all prefixes of
84 // the path are called the element's <em>ancestors</em>.
85 // An entity path is always fully complete: ALL of the entity's ancestors
86 // are required to be in the path along with the entity identifier itself.
87 // The only exception is that in some documented cases, the identifier in the
88 // last path element (for the entity) itself may be omitted. A path can never
89 // be empty.
90 repeated PathElement path_element = 2;
91 }
92
93 // A message that can hold any of the supported value types and associated
94 // metadata.
95 //
96 // At most one of the <type>Value fields may be set.
97 // If none are set the value is "null".
98 //
99 message Value {
100 // A boolean value.
101 optional bool boolean_value = 1;
102 // An integer value.
103 optional int64 integer_value = 2;
104 // A double value.
105 optional double double_value = 3;
106 // A timestamp value.
107 optional int64 timestamp_microseconds_value = 4;
108 // A key value.
109 optional Key key_value = 5;
110 // A blob key value.
111 optional string blob_key_value = 16;
112 // A UTF-8 encoded string value.
113 optional string string_value = 17;
114 // A blob value.
115 optional bytes blob_value = 18;
116 // An entity value.
117 // May have no key.
118 // May have a key with an incomplete key path.
119 // May have a reserved/read-only key.
120 optional Entity entity_value = 6;
121 // A list value.
122 // Cannot contain another list value.
123 // Cannot also have a meaning and indexing set.
124 repeated Value list_value = 7;
125
126 // The <code>meaning</code> field is reserved and should not be used.
127 optional int32 meaning = 14;
128
129 // If the value should be indexed.
130 //
131 // The <code>indexed</code> property may be set for a
132 // <code>null</code> value.
133 // When <code>indexed</code> is <code>true</code>, <code>stringValue</code>
134 // is limited to 500 characters and the blob value is limited to 500 bytes.
135 // Exception: If meaning is set to 2, string_value is limited to 2038
136 // characters regardless of indexed.
137 // When indexed is true, meaning 15 and 22 are not allowed, and meaning 16
138 // will be ignored on input (and will never be set on output).
139 // Input values by default have <code>indexed</code> set to
140 // <code>true</code>; however, you can explicitly set <code>indexed</code> to
141 // <code>true</code> if you want. (An output value never has
142 // <code>indexed</code> explicitly set to <code>true</code>.) If a value is
143 // itself an entity, it cannot have <code>indexed</code> set to
144 // <code>true</code>.
145 // Exception: An entity value with meaning 9, 20 or 21 may be indexed.
146 optional bool indexed = 15 [default = true];
147 }
148
149 // An entity property.
150 message Property {
151 // The name of the property.
152 // A property name matching regex "__.*__" is reserved.
153 // A reserved property name is forbidden in certain documented contexts.
154 // The name must not contain more than 500 characters.
155 // Cannot be "".
156 required string name = 1;
157
158 // The value(s) of the property.
159 // Each value can have only one value property populated. For example,
160 // you cannot have a values list of <code>{ value: { integerValue: 22,
161 // stringValue: "a" } }</code>, but you can have <code>{ value: { listValue:
162 // [ { integerValue: 22 }, { stringValue: "a" } ] }</code>.
163 required Value value = 4;
164 }
165
166 // An entity.
167 //
168 // An entity is limited to 1 megabyte when stored. That <em>roughly</em>
169 // corresponds to a limit of 1 megabyte for the serialized form of this
170 // message.
171 message Entity {
172 // The entity's key.
173 //
174 // An entity must have a key, unless otherwise documented (for example,
175 // an entity in <code>Value.entityValue</code> may have no key).
176 // An entity's kind is its key's path's last element's kind,
177 // or null if it has no key.
178 optional Key key = 1;
179 // The entity's properties.
180 // Each property's name must be unique for its entity.
181 repeated Property property = 2;
182 }
183
184 // The result of fetching an entity from the datastore.
185 message EntityResult {
186 // Specifies what data the 'entity' field contains.
187 // A ResultType is either implied (for example, in LookupResponse.found it
188 // is always FULL) or specified by context (for example, in message
189 // QueryResultBatch, field 'entity_result_type' specifies a ResultType
190 // for all the values in field 'entity_result').
191 enum ResultType {
192 FULL = 1; // The entire entity.
193 PROJECTION = 2; // A projected subset of properties.
194 // The entity may have no key.
195 // A property value may have meaning 18.
196 KEY_ONLY = 3; // Only the key.
197 }
198
199 // The resulting entity.
200 required Entity entity = 1;
201 }
202
203 // A query.
204 message Query {
205 // The projection to return. If not set the entire entity is returned.
206 repeated PropertyExpression projection = 2;
207
208 // The kinds to query (if empty, returns entities from all kinds).
209 repeated KindExpression kind = 3;
210
211 // The filter to apply (optional).
212 optional Filter filter = 4;
213
214 // The order to apply to the query results (if empty, order is unspecified).
215 repeated PropertyOrder order = 5;
216
217 // The properties to group by (if empty, no grouping is applied to the
218 // result set).
219 repeated PropertyReference group_by = 6;
220
221 // A starting point for the query results. Optional. Query cursors are
222 // returned in query result batches.
223 optional bytes /* serialized QueryCursor */ start_cursor = 7;
224
225 // An ending point for the query results. Optional. Query cursors are
226 // returned in query result batches.
227 optional bytes /* serialized QueryCursor */ end_cursor = 8;
228
229 // The number of results to skip. Applies before limit, but after all other
230 // constraints (optional, defaults to 0).
231 optional int32 offset = 10 [default=0];
232
233 // The maximum number of results to return. Applies after all other
234 // constraints. Optional.
235 optional int32 limit = 11;
236 }
237
238 // A representation of a kind.
239 message KindExpression {
240 // The name of the kind.
241 required string name = 1;
242 }
243
244 // A reference to a property relative to the kind expressions.
245 // exactly.
246 message PropertyReference {
247 // The name of the property.
248 required string name = 2;
249 }
250
251 // A representation of a property in a projection.
252 message PropertyExpression {
253 enum AggregationFunction {
254 FIRST = 1;
255 }
256 // The property to project.
257 required PropertyReference property = 1;
258 // The aggregation function to apply to the property. Optional.
259 // Can only be used when grouping by at least one property. Must
260 // then be set on all properties in the projection that are not
261 // being grouped by.
262 optional AggregationFunction aggregation_function = 2;
263 }
264
265 // The desired order for a specific property.
266 message PropertyOrder {
267 enum Direction {
268 ASCENDING = 1;
269 DESCENDING = 2;
270 }
271 // The property to order by.
272 required PropertyReference property = 1;
273 // The direction to order by.
274 optional Direction direction = 2 [default=ASCENDING];
275 }
276
277 // A holder for any type of filter. Exactly one field should be specified.
278 message Filter {
279 // A composite filter.
280 optional CompositeFilter composite_filter = 1;
281 // A filter on a property.
282 optional PropertyFilter property_filter = 2;
283 }
284
285 // A filter that merges the multiple other filters using the given operation.
286 message CompositeFilter {
287 enum Operator {
288 AND = 1;
289 }
290
291 // The operator for combining multiple filters.
292 required Operator operator = 1;
293 // The list of filters to combine.
294 // Must contain at least one filter.
295 repeated Filter filter = 2;
296 }
297
298 // A filter on a specific property.
299 message PropertyFilter {
300 enum Operator {
301 LESS_THAN = 1;
302 LESS_THAN_OR_EQUAL = 2;
303 GREATER_THAN = 3;
304 GREATER_THAN_OR_EQUAL = 4;
305 EQUAL = 5;
306
307 HAS_ANCESTOR = 11;
308 }
309
310 // The property to filter by.
311 required PropertyReference property = 1;
312 // The operator to filter by.
313 required Operator operator = 2;
314 // The value to compare the property to.
315 required Value value = 3;
316 }
317
318 // A GQL query.
319 message GqlQuery {
320 required string query_string = 1;
321 // When false, the query string must not contain a literal.
322 optional bool allow_literal = 2 [default = false];
323 // A named argument must set field GqlQueryArg.name.
324 // No two named arguments may have the same name.
325 // For each non-reserved named binding site in the query string,
326 // there must be a named argument with that name,
327 // but not necessarily the inverse.
328 repeated GqlQueryArg name_arg = 3;
329 // Numbered binding site @1 references the first numbered argument,
330 // effectively using 1-based indexing, rather than the usual 0.
331 // A numbered argument must NOT set field GqlQueryArg.name.
332 // For each binding site numbered i in query_string,
333 // there must be an ith numbered argument.
334 // The inverse must also be true.
335 repeated GqlQueryArg number_arg = 4;
336 }
337
338 // A binding argument for a GQL query.
339 // Exactly one of fields value and cursor must be set.
340 message GqlQueryArg {
341 // Must match regex "[A-Za-z_$][A-Za-z_$0-9]*".
342 // Must not match regex "__.*__".
343 // Must not be "".
344 optional string name = 1;
345 optional Value value = 2;
346 optional bytes cursor = 3;
347 }
348
349 // A batch of results produced by a query.
350 message QueryResultBatch {
351 // The possible values for the 'more_results' field.
352 enum MoreResultsType {
353 NOT_FINISHED = 1; // There are additional batches to fetch from this query.
354 MORE_RESULTS_AFTER_LIMIT = 2; // The query is finished, but there are more
355 // results after the limit.
356 NO_MORE_RESULTS = 3; // The query has been exhausted.
357 }
358
359 // The result type for every entity in entityResults.
360 required EntityResult.ResultType entity_result_type = 1;
361 // The results for this batch.
362 repeated EntityResult entity_result = 2;
363
364 // A cursor that points to the position after the last result in the batch.
365 // May be absent.
366 optional bytes /* serialized QueryCursor */ end_cursor = 4;
367
368 // The state of the query after the current batch.
369 required MoreResultsType more_results = 5;
370
371 // The number of results skipped because of <code>Query.offset</code>.
372 optional int32 skipped_results = 6;
373 }
374
375 // A set of changes to apply.
376 //
377 // No entity in this message may have a reserved property name,
378 // not even a property in an entity in a value.
379 // No value in this message may have meaning 18,
380 // not even a value in an entity in another value.
381 //
382 // If entities with duplicate keys are present, an arbitrary choice will
383 // be made as to which is written.
384 message Mutation {
385 // Entities to upsert.
386 // Each upserted entity's key must have a complete path and
387 // must not be reserved/read-only.
388 repeated Entity upsert = 1;
389 // Entities to update.
390 // Each updated entity's key must have a complete path and
391 // must not be reserved/read-only.
392 repeated Entity update = 2;
393 // Entities to insert.
394 // Each inserted entity's key must have a complete path and
395 // must not be reserved/read-only.
396 repeated Entity insert = 3;
397 // Insert entities with a newly allocated ID.
398 // Each inserted entity's key must omit the final identifier in its path and
399 // must not be reserved/read-only.
400 repeated Entity insert_auto_id = 4;
401 // Keys of entities to delete.
402 // Each key must have a complete key path and must not be reserved/read-only.
403 repeated Key delete = 5;
404 // Ignore a user specified read-only period. Optional.
405 optional bool force = 6;
406 }
407
408 // The result of applying a mutation.
409 message MutationResult {
410 // Number of index writes.
411 required int32 index_updates = 1;
412 // Keys for <code>insertAutoId</code> entities. One per entity from the
413 // request, in the same order.
414 repeated Key insert_auto_id_key = 2;
415 }
416
417 // Options shared by read requests.
418 message ReadOptions {
419 enum ReadConsistency {
420 DEFAULT = 0;
421 STRONG = 1;
422 EVENTUAL = 2;
423 }
424
425 // The read consistency to use.
426 // Cannot be set when transaction is set.
427 // Lookup and ancestor queries default to STRONG, global queries default to
428 // EVENTUAL and cannot be set to STRONG.
429 optional ReadConsistency read_consistency = 1 [default=DEFAULT];
430
431 // The transaction to use. Optional.
432 optional bytes /* serialized Transaction */ transaction = 2;
433 }
434
435 // The request for Lookup.
436 message LookupRequest {
437
438 // Options for this lookup request. Optional.
439 optional ReadOptions read_options = 1;
440 // Keys of entities to look up from the datastore.
441 repeated Key key = 3;
442 }
443
444 // The response for Lookup.
445 message LookupResponse {
446
447 // The order of results in these fields is undefined and has no relation to
448 // the order of the keys in the input.
449
450 // Entities found as ResultType.FULL entities.
451 repeated EntityResult found = 1;
452
453 // Entities not found as ResultType.KEY_ONLY entities.
454 repeated EntityResult missing = 2;
455
456 // A list of keys that were not looked up due to resource constraints.
457 repeated Key deferred = 3;
458 }
459
460
461 // The request for RunQuery.
462 message RunQueryRequest {
463
464 // The options for this query.
465 optional ReadOptions read_options = 1;
466
467 // Entities are partitioned into subsets, identified by a dataset (usually
468 // implicitly specified by the project) and namespace ID. Queries are scoped
469 // to a single partition.
470 // This partition ID is normalized with the standard default context
471 // partition ID, but all other partition IDs in RunQueryRequest are
472 // normalized with this partition ID as the context partition ID.
473 optional PartitionId partition_id = 2;
474
475 // The query to run.
476 // Either this field or field gql_query must be set, but not both.
477 optional Query query = 3;
478 // The GQL query to run.
479 // Either this field or field query must be set, but not both.
480 optional GqlQuery gql_query = 7;
481 }
482
483 // The response for RunQuery.
484 message RunQueryResponse {
485
486 // A batch of query results (always present).
487 optional QueryResultBatch batch = 1;
488
489 }
490
491 // The request for BeginTransaction.
492 message BeginTransactionRequest {
493
494 enum IsolationLevel {
495 SNAPSHOT = 0; // Read from a consistent snapshot. Concurrent transactions
496 // conflict if their mutations conflict. For example:
497 // Read(A),Write(B) may not conflict with Read(B),Write(A),
498 // but Read(B),Write(B) does conflict with Read(B),Write(B).
499 SERIALIZABLE = 1; // Read from a consistent snapshot. Concurrent
500 // transactions conflict if they cannot be serialized.
501 // For example Read(A),Write(B) does conflict with
502 // Read(B),Write(A) but Read(A) may not conflict with
503 // Write(A).
504 }
505
506 // The transaction isolation level.
507 optional IsolationLevel isolation_level = 1 [default=SNAPSHOT];
508 }
509
510 // The response for BeginTransaction.
511 message BeginTransactionResponse {
512
513 // The transaction identifier (always present).
514 optional bytes /* serialized Transaction */ transaction = 1;
515 }
516
517 // The request for Rollback.
518 message RollbackRequest {
519
520 // The transaction identifier, returned by a call to
521 // <code>beginTransaction</code>.
522 required bytes /* serialized Transaction */ transaction = 1;
523 }
524
525 // The response for Rollback.
526 message RollbackResponse {
527 // Empty
528 }
529
530 // The request for Commit.
531 message CommitRequest {
532
533 enum Mode {
534 TRANSACTIONAL = 1;
535 NON_TRANSACTIONAL = 2;
536 }
537
538 // The transaction identifier, returned by a call to
539 // <code>beginTransaction</code>. Must be set when mode is TRANSACTIONAL.
540 optional bytes /* serialized Transaction */ transaction = 1;
541 // The mutation to perform. Optional.
542 optional Mutation mutation = 2;
543 // The type of commit to perform. Either TRANSACTIONAL or NON_TRANSACTIONAL.
544 optional Mode mode = 5 [default=TRANSACTIONAL];
545 }
546
547 // The response for Commit.
548 message CommitResponse {
549
550 // The result of performing the mutation (if any).
551 optional MutationResult mutation_result = 1;
552 }
553
554 // The request for AllocateIds.
555 message AllocateIdsRequest {
556
557 // A list of keys with incomplete key paths to allocate IDs for.
558 // No key may be reserved/read-only.
559 repeated Key key = 1;
560 }
561
562 // The response for AllocateIds.
563 message AllocateIdsResponse {
564
565 // The keys specified in the request (in the same order), each with
566 // its key path completed with a newly allocated ID.
567 repeated Key key = 1;
568 }
569
570 // Each rpc normalizes the partition IDs of the keys in its input entities,
571 // and always returns entities with keys with normalized partition IDs.
572 // (Note that applies to all entities, including entities in values.)
573 service DatastoreService {
574 // Look up some entities by key.
575 rpc Lookup(LookupRequest) returns (LookupResponse) {
576 };
577 // Query for entities.
578 rpc RunQuery(RunQueryRequest) returns (RunQueryResponse) {
579 };
580 // Begin a new transaction.
581 rpc BeginTransaction(BeginTransactionRequest) returns (BeginTransactionRespons e) {
582 };
583 // Commit a transaction, optionally creating, deleting or modifying some
584 // entities.
585 rpc Commit(CommitRequest) returns (CommitResponse) {
586 };
587 // Roll back a transaction.
588 rpc Rollback(RollbackRequest) returns (RollbackResponse) {
589 };
590 // Allocate IDs for incomplete keys (useful for referencing an entity before
591 // it is inserted).
592 rpc AllocateIds(AllocateIdsRequest) returns (AllocateIdsResponse) {
593 };
594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698