xref: /aosp_15_r20/external/googleapis/google/datastore/admin/v1/index.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
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
15syntax = "proto3";
16
17package google.datastore.admin.v1;
18
19import "google/api/field_behavior.proto";
20
21option csharp_namespace = "Google.Cloud.Datastore.Admin.V1";
22option go_package = "cloud.google.com/go/datastore/admin/apiv1/adminpb;adminpb";
23option java_multiple_files = true;
24option java_outer_classname = "IndexProto";
25option java_package = "com.google.datastore.admin.v1";
26option php_namespace = "Google\\Cloud\\Datastore\\Admin\\V1";
27option ruby_package = "Google::Cloud::Datastore::Admin::V1";
28
29// Datastore composite index definition.
30message Index {
31  // For an ordered index, specifies whether each of the entity's ancestors
32  // will be included.
33  enum AncestorMode {
34    // The ancestor mode is unspecified.
35    ANCESTOR_MODE_UNSPECIFIED = 0;
36
37    // Do not include the entity's ancestors in the index.
38    NONE = 1;
39
40    // Include all the entity's ancestors in the index.
41    ALL_ANCESTORS = 2;
42  }
43
44  // The direction determines how a property is indexed.
45  enum Direction {
46    // The direction is unspecified.
47    DIRECTION_UNSPECIFIED = 0;
48
49    // The property's values are indexed so as to support sequencing in
50    // ascending order and also query by <, >, <=, >=, and =.
51    ASCENDING = 1;
52
53    // The property's values are indexed so as to support sequencing in
54    // descending order and also query by <, >, <=, >=, and =.
55    DESCENDING = 2;
56  }
57
58  // A property of an index.
59  message IndexedProperty {
60    // Required. The property name to index.
61    string name = 1 [(google.api.field_behavior) = REQUIRED];
62
63    // Required. The indexed property's direction.  Must not be
64    // DIRECTION_UNSPECIFIED.
65    Direction direction = 2 [(google.api.field_behavior) = REQUIRED];
66  }
67
68  // The possible set of states of an index.
69  enum State {
70    // The state is unspecified.
71    STATE_UNSPECIFIED = 0;
72
73    // The index is being created, and cannot be used by queries.
74    // There is an active long-running operation for the index.
75    // The index is updated when writing an entity.
76    // Some index data may exist.
77    CREATING = 1;
78
79    // The index is ready to be used.
80    // The index is updated when writing an entity.
81    // The index is fully populated from all stored entities it applies to.
82    READY = 2;
83
84    // The index is being deleted, and cannot be used by queries.
85    // There is an active long-running operation for the index.
86    // The index is not updated when writing an entity.
87    // Some index data may exist.
88    DELETING = 3;
89
90    // The index was being created or deleted, but something went wrong.
91    // The index cannot by used by queries.
92    // There is no active long-running operation for the index,
93    // and the most recently finished long-running operation failed.
94    // The index is not updated when writing an entity.
95    // Some index data may exist.
96    ERROR = 4;
97  }
98
99  // Output only. Project ID.
100  string project_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
101
102  // Output only. The resource ID of the index.
103  string index_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
104
105  // Required. The entity kind to which this index applies.
106  string kind = 4 [(google.api.field_behavior) = REQUIRED];
107
108  // Required. The index's ancestor mode.  Must not be
109  // ANCESTOR_MODE_UNSPECIFIED.
110  AncestorMode ancestor = 5 [(google.api.field_behavior) = REQUIRED];
111
112  // Required. An ordered sequence of property names and their index attributes.
113  //
114  // Requires:
115  //
116  // * A maximum of 100 properties.
117  repeated IndexedProperty properties = 6
118      [(google.api.field_behavior) = REQUIRED];
119
120  // Output only. The state of the index.
121  State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
122}
123