| 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/protobuf/struct.proto"; |
| 21 |
import "google/protobuf/timestamp.proto"; |
| 22 |
import "google/type/latlng.proto"; |
| 23 |
|
| 24 |
option csharp_namespace = "Google.Cloud.Datastore.V1Beta3"; |
| 25 |
option go_package = "google.golang.org/genproto/googleapis/datastore/v1beta3;datastore"; |
| 26 |
option java_multiple_files = true; |
| 27 |
option java_outer_classname = "EntityProto"; |
| 28 |
option java_package = "com.google.datastore.v1beta3"; |
| 29 |
|
| 30 |
|
| 31 |
// A partition ID identifies a grouping of entities. The grouping is always |
| 32 |
// by project and namespace, however the namespace ID may be empty. |
| 33 |
// |
| 34 |
// A partition ID contains several dimensions: |
| 35 |
// project ID and namespace ID. |
| 36 |
// |
| 37 |
// Partition dimensions: |
| 38 |
// |
| 39 |
// - May be `""`. |
| 40 |
// - Must be valid UTF-8 bytes. |
| 41 |
// - Must have values that match regex `[A-Za-z\d\.\-_]{1,100}` |
| 42 |
// If the value of any dimension matches regex `__.*__`, the partition is |
| 43 |
// reserved/read-only. |
| 44 |
// A reserved/read-only partition ID is forbidden in certain documented |
| 45 |
// contexts. |
| 46 |
// |
| 47 |
// Foreign partition IDs (in which the project ID does |
| 48 |
// not match the context project ID ) are discouraged. |
| 49 |
// Reads and writes of foreign partition IDs may fail if the project is not in an active state. |
| 50 |
message PartitionId { |
| 51 |
// The ID of the project to which the entities belong. |
| 52 |
string project_id = 2; |
| 53 |
|
| 54 |
// If not empty, the ID of the namespace to which the entities belong. |
| 55 |
string namespace_id = 4; |
| 56 |
} |
| 57 |
|
| 58 |
// A unique identifier for an entity. |
| 59 |
// If a key's partition ID or any of its path kinds or names are |
| 60 |
// reserved/read-only, the key is reserved/read-only. |
| 61 |
// A reserved/read-only key is forbidden in certain documented contexts. |
| 62 |
message Key { |
| 63 |
// A (kind, ID/name) pair used to construct a key path. |
| 64 |
// |
| 65 |
// If either name or ID is set, the element is complete. |
| 66 |
// If neither is set, the element is incomplete. |
| 67 |
message PathElement { |
| 68 |
// The kind of the entity. |
| 69 |
// A kind matching regex `__.*__` is reserved/read-only. |
| 70 |
// A kind must not contain more than 1500 bytes when UTF-8 encoded. |
| 71 |
// Cannot be `""`. |
| 72 |
string kind = 1; |
| 73 |
|
| 74 |
// The type of ID. |
| 75 |
oneof id_type { |
| 76 |
// The auto-allocated ID of the entity. |
| 77 |
// Never equal to zero. Values less than zero are discouraged and may not |
| 78 |
// be supported in the future. |
| 79 |
int64 id = 2; |
| 80 |
|
| 81 |
// The name of the entity. |
| 82 |
// A name matching regex `__.*__` is reserved/read-only. |
| 83 |
// A name must not be more than 1500 bytes when UTF-8 encoded. |
| 84 |
// Cannot be `""`. |
| 85 |
string name = 3; |
| 86 |
} |
| 87 |
} |
| 88 |
|
| 89 |
// Entities are partitioned into subsets, currently identified by a project |
| 90 |
// ID and namespace ID. |
| 91 |
// Queries are scoped to a single partition. |
| 92 |
PartitionId partition_id = 1; |
| 93 |
|
| 94 |
// The entity path. |
| 95 |
// An entity path consists of one or more elements composed of a kind and a |
| 96 |
// string or numerical identifier, which identify entities. The first |
| 97 |
// element identifies a _root entity_, the second element identifies |
| 98 |
// a _child_ of the root entity, the third element identifies a child of the |
| 99 |
// second entity, and so forth. The entities identified by all prefixes of |
| 100 |
// the path are called the element's _ancestors_. |
| 101 |
// |
| 102 |
// An entity path is always fully complete: *all* of the entity's ancestors |
| 103 |
// are required to be in the path along with the entity identifier itself. |
| 104 |
// The only exception is that in some documented cases, the identifier in the |
| 105 |
// last path element (for the entity) itself may be omitted. For example, |
| 106 |
// the last path element of the key of `Mutation.insert` may have no |
| 107 |
// identifier. |
| 108 |
// |
| 109 |
// A path can never be empty, and a path can have at most 100 elements. |
| 110 |
repeated PathElement path = 2; |
| 111 |
} |
| 112 |
|
| 113 |
// An array value. |
| 114 |
message ArrayValue { |
| 115 |
// Values in the array. |
| 116 |
// The order of this array may not be preserved if it contains a mix of |
| 117 |
// indexed and unindexed values. |
| 118 |
repeated Value values = 1; |
| 119 |
} |
| 120 |
|
| 121 |
// A message that can hold any of the supported value types and associated |
| 122 |
// metadata. |
| 123 |
message Value { |
| 124 |
// Must have a value set. |
| 125 |
oneof value_type { |
| 126 |
// A null value. |
| 127 |
google.protobuf.NullValue null_value = 11; |
| 128 |
|
| 129 |
// A boolean value. |
| 130 |
bool boolean_value = 1; |
| 131 |
|
| 132 |
// An integer value. |
| 133 |
int64 integer_value = 2; |
| 134 |
|
| 135 |
// A double value. |
| 136 |
double double_value = 3; |
| 137 |
|
| 138 |
// A timestamp value. |
| 139 |
// When stored in the Datastore, precise only to microseconds; |
| 140 |
// any additional precision is rounded down. |
| 141 |
google.protobuf.Timestamp timestamp_value = 10; |
| 142 |
|
| 143 |
// A key value. |
| 144 |
Key key_value = 5; |
| 145 |
|
| 146 |
// A UTF-8 encoded string value. |
| 147 |
// When `exclude_from_indexes` is false (it is indexed) , may have at most 1500 bytes. |
| 148 |
// Otherwise, may be set to at least 1,000,000 bytes. |
| 149 |
string string_value = 17; |
| 150 |
|
| 151 |
// A blob value. |
| 152 |
// May have at most 1,000,000 bytes. |
| 153 |
// When `exclude_from_indexes` is false, may have at most 1500 bytes. |
| 154 |
// In JSON requests, must be base64-encoded. |
| 155 |
bytes blob_value = 18; |
| 156 |
|
| 157 |
// A geo point value representing a point on the surface of Earth. |
| 158 |
google.type.LatLng geo_point_value = 8; |
| 159 |
|
| 160 |
// An entity value. |
| 161 |
// |
| 162 |
// - May have no key. |
| 163 |
// - May have a key with an incomplete key path. |
| 164 |
// - May have a reserved/read-only key. |
| 165 |
Entity entity_value = 6; |
| 166 |
|
| 167 |
// An array value. |
| 168 |
// Cannot contain another array value. |
| 169 |
// A `Value` instance that sets field `array_value` must not set fields |
| 170 |
// `meaning` or `exclude_from_indexes`. |
| 171 |
ArrayValue array_value = 9; |
| 172 |
} |
| 173 |
|
| 174 |
// The `meaning` field should only be populated for backwards compatibility. |
| 175 |
int32 meaning = 14; |
| 176 |
|
| 177 |
// If the value should be excluded from all indexes including those defined |
| 178 |
// explicitly. |
| 179 |
bool exclude_from_indexes = 19; |
| 180 |
} |
| 181 |
|
| 182 |
// A Datastore data object. |
| 183 |
// |
| 184 |
// An entity is limited to 1 megabyte when stored. That _roughly_ |
| 185 |
// corresponds to a limit of 1 megabyte for the serialized form of this |
| 186 |
// message. |
| 187 |
message Entity { |
| 188 |
// The entity's key. |
| 189 |
// |
| 190 |
// An entity must have a key, unless otherwise documented (for example, |
| 191 |
// an entity in `Value.entity_value` may have no key). |
| 192 |
// An entity's kind is its key path's last element's kind, |
| 193 |
// or null if it has no key. |
| 194 |
Key key = 1; |
| 195 |
|
| 196 |
// The entity's properties. |
| 197 |
// The map's keys are property names. |
| 198 |
// A property name matching regex `__.*__` is reserved. |
| 199 |
// A reserved property name is forbidden in certain documented contexts. |
| 200 |
// The name must not contain more than 500 characters. |
| 201 |
// The name cannot be `""`. |
| 202 |
map<string, Value> properties = 3; |
| 203 |
} |