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