1syntax = "proto2"; 2option go_package = "datastore"; 3 4package appengine; 5 6message Action{} 7 8message PropertyValue { 9 optional int64 int64Value = 1; 10 optional bool booleanValue = 2; 11 optional string stringValue = 3; 12 optional double doubleValue = 4; 13 14 optional group PointValue = 5 { 15 required double x = 6; 16 required double y = 7; 17 } 18 19 optional group UserValue = 8 { 20 required string email = 9; 21 required string auth_domain = 10; 22 optional string nickname = 11; 23 optional string federated_identity = 21; 24 optional string federated_provider = 22; 25 } 26 27 optional group ReferenceValue = 12 { 28 required string app = 13; 29 optional string name_space = 20; 30 repeated group PathElement = 14 { 31 required string type = 15; 32 optional int64 id = 16; 33 optional string name = 17; 34 } 35 } 36} 37 38message Property { 39 enum Meaning { 40 NO_MEANING = 0; 41 BLOB = 14; 42 TEXT = 15; 43 BYTESTRING = 16; 44 45 ATOM_CATEGORY = 1; 46 ATOM_LINK = 2; 47 ATOM_TITLE = 3; 48 ATOM_CONTENT = 4; 49 ATOM_SUMMARY = 5; 50 ATOM_AUTHOR = 6; 51 52 GD_WHEN = 7; 53 GD_EMAIL = 8; 54 GEORSS_POINT = 9; 55 GD_IM = 10; 56 57 GD_PHONENUMBER = 11; 58 GD_POSTALADDRESS = 12; 59 60 GD_RATING = 13; 61 62 BLOBKEY = 17; 63 ENTITY_PROTO = 19; 64 65 INDEX_VALUE = 18; 66 }; 67 68 optional Meaning meaning = 1 [default = NO_MEANING]; 69 optional string meaning_uri = 2; 70 71 required string name = 3; 72 73 required PropertyValue value = 5; 74 75 required bool multiple = 4; 76 77 optional bool searchable = 6 [default=false]; 78 79 enum FtsTokenizationOption { 80 HTML = 1; 81 ATOM = 2; 82 } 83 84 optional FtsTokenizationOption fts_tokenization_option = 8; 85 86 optional string locale = 9 [default = "en"]; 87} 88 89message Path { 90 repeated group Element = 1 { 91 required string type = 2; 92 optional int64 id = 3; 93 optional string name = 4; 94 } 95} 96 97message Reference { 98 required string app = 13; 99 optional string name_space = 20; 100 required Path path = 14; 101} 102 103message User { 104 required string email = 1; 105 required string auth_domain = 2; 106 optional string nickname = 3; 107 optional string federated_identity = 6; 108 optional string federated_provider = 7; 109} 110 111message EntityProto { 112 required Reference key = 13; 113 required Path entity_group = 16; 114 optional User owner = 17; 115 116 enum Kind { 117 GD_CONTACT = 1; 118 GD_EVENT = 2; 119 GD_MESSAGE = 3; 120 } 121 optional Kind kind = 4; 122 optional string kind_uri = 5; 123 124 repeated Property property = 14; 125 repeated Property raw_property = 15; 126 127 optional int32 rank = 18; 128} 129 130message CompositeProperty { 131 required int64 index_id = 1; 132 repeated string value = 2; 133} 134 135message Index { 136 required string entity_type = 1; 137 required bool ancestor = 5; 138 repeated group Property = 2 { 139 required string name = 3; 140 enum Direction { 141 ASCENDING = 1; 142 DESCENDING = 2; 143 } 144 optional Direction direction = 4 [default = ASCENDING]; 145 } 146} 147 148message CompositeIndex { 149 required string app_id = 1; 150 required int64 id = 2; 151 required Index definition = 3; 152 153 enum State { 154 WRITE_ONLY = 1; 155 READ_WRITE = 2; 156 DELETED = 3; 157 ERROR = 4; 158 } 159 required State state = 4; 160 161 optional bool only_use_if_required = 6 [default = false]; 162} 163 164message IndexPostfix { 165 message IndexValue { 166 required string property_name = 1; 167 required PropertyValue value = 2; 168 } 169 170 repeated IndexValue index_value = 1; 171 172 optional Reference key = 2; 173 174 optional bool before = 3 [default=true]; 175} 176 177message IndexPosition { 178 optional string key = 1; 179 180 optional bool before = 2 [default=true]; 181} 182 183message Snapshot { 184 enum Status { 185 INACTIVE = 0; 186 ACTIVE = 1; 187 } 188 189 required int64 ts = 1; 190} 191 192message InternalHeader { 193 optional string qos = 1; 194} 195 196message Transaction { 197 optional InternalHeader header = 4; 198 required fixed64 handle = 1; 199 required string app = 2; 200 optional bool mark_changes = 3 [default = false]; 201} 202 203message Query { 204 optional InternalHeader header = 39; 205 206 required string app = 1; 207 optional string name_space = 29; 208 209 optional string kind = 3; 210 optional Reference ancestor = 17; 211 212 repeated group Filter = 4 { 213 enum Operator { 214 LESS_THAN = 1; 215 LESS_THAN_OR_EQUAL = 2; 216 GREATER_THAN = 3; 217 GREATER_THAN_OR_EQUAL = 4; 218 EQUAL = 5; 219 IN = 6; 220 EXISTS = 7; 221 } 222 223 required Operator op = 6; 224 repeated Property property = 14; 225 } 226 227 optional string search_query = 8; 228 229 repeated group Order = 9 { 230 enum Direction { 231 ASCENDING = 1; 232 DESCENDING = 2; 233 } 234 235 required string property = 10; 236 optional Direction direction = 11 [default = ASCENDING]; 237 } 238 239 enum Hint { 240 ORDER_FIRST = 1; 241 ANCESTOR_FIRST = 2; 242 FILTER_FIRST = 3; 243 } 244 optional Hint hint = 18; 245 246 optional int32 count = 23; 247 248 optional int32 offset = 12 [default = 0]; 249 250 optional int32 limit = 16; 251 252 optional CompiledCursor compiled_cursor = 30; 253 optional CompiledCursor end_compiled_cursor = 31; 254 255 repeated CompositeIndex composite_index = 19; 256 257 optional bool require_perfect_plan = 20 [default = false]; 258 259 optional bool keys_only = 21 [default = false]; 260 261 optional Transaction transaction = 22; 262 263 optional bool compile = 25 [default = false]; 264 265 optional int64 failover_ms = 26; 266 267 optional bool strong = 32; 268 269 repeated string property_name = 33; 270 271 repeated string group_by_property_name = 34; 272 273 optional bool distinct = 24; 274 275 optional int64 min_safe_time_seconds = 35; 276 277 repeated string safe_replica_name = 36; 278 279 optional bool persist_offset = 37 [default=false]; 280} 281 282message CompiledQuery { 283 required group PrimaryScan = 1 { 284 optional string index_name = 2; 285 286 optional string start_key = 3; 287 optional bool start_inclusive = 4; 288 optional string end_key = 5; 289 optional bool end_inclusive = 6; 290 291 repeated string start_postfix_value = 22; 292 repeated string end_postfix_value = 23; 293 294 optional int64 end_unapplied_log_timestamp_us = 19; 295 } 296 297 repeated group MergeJoinScan = 7 { 298 required string index_name = 8; 299 300 repeated string prefix_value = 9; 301 302 optional bool value_prefix = 20 [default=false]; 303 } 304 305 optional Index index_def = 21; 306 307 optional int32 offset = 10 [default = 0]; 308 309 optional int32 limit = 11; 310 311 required bool keys_only = 12; 312 313 repeated string property_name = 24; 314 315 optional int32 distinct_infix_size = 25; 316 317 optional group EntityFilter = 13 { 318 optional bool distinct = 14 [default=false]; 319 320 optional string kind = 17; 321 optional Reference ancestor = 18; 322 } 323} 324 325message CompiledCursor { 326 optional group Position = 2 { 327 optional string start_key = 27; 328 329 repeated group IndexValue = 29 { 330 optional string property = 30; 331 required PropertyValue value = 31; 332 } 333 334 optional Reference key = 32; 335 336 optional bool start_inclusive = 28 [default=true]; 337 } 338} 339 340message Cursor { 341 required fixed64 cursor = 1; 342 343 optional string app = 2; 344} 345 346message Error { 347 enum ErrorCode { 348 BAD_REQUEST = 1; 349 CONCURRENT_TRANSACTION = 2; 350 INTERNAL_ERROR = 3; 351 NEED_INDEX = 4; 352 TIMEOUT = 5; 353 PERMISSION_DENIED = 6; 354 BIGTABLE_ERROR = 7; 355 COMMITTED_BUT_STILL_APPLYING = 8; 356 CAPABILITY_DISABLED = 9; 357 TRY_ALTERNATE_BACKEND = 10; 358 SAFE_TIME_TOO_OLD = 11; 359 } 360} 361 362message Cost { 363 optional int32 index_writes = 1; 364 optional int32 index_write_bytes = 2; 365 optional int32 entity_writes = 3; 366 optional int32 entity_write_bytes = 4; 367 optional group CommitCost = 5 { 368 optional int32 requested_entity_puts = 6; 369 optional int32 requested_entity_deletes = 7; 370 }; 371 optional int32 approximate_storage_delta = 8; 372 optional int32 id_sequence_updates = 9; 373} 374 375message GetRequest { 376 optional InternalHeader header = 6; 377 378 repeated Reference key = 1; 379 optional Transaction transaction = 2; 380 381 optional int64 failover_ms = 3; 382 383 optional bool strong = 4; 384 385 optional bool allow_deferred = 5 [default=false]; 386} 387 388message GetResponse { 389 repeated group Entity = 1 { 390 optional EntityProto entity = 2; 391 optional Reference key = 4; 392 393 optional int64 version = 3; 394 } 395 396 repeated Reference deferred = 5; 397 398 optional bool in_order = 6 [default=true]; 399} 400 401message PutRequest { 402 optional InternalHeader header = 11; 403 404 repeated EntityProto entity = 1; 405 optional Transaction transaction = 2; 406 repeated CompositeIndex composite_index = 3; 407 408 optional bool trusted = 4 [default = false]; 409 410 optional bool force = 7 [default = false]; 411 412 optional bool mark_changes = 8 [default = false]; 413 repeated Snapshot snapshot = 9; 414 415 enum AutoIdPolicy { 416 CURRENT = 0; 417 SEQUENTIAL = 1; 418 } 419 optional AutoIdPolicy auto_id_policy = 10 [default = CURRENT]; 420} 421 422message PutResponse { 423 repeated Reference key = 1; 424 optional Cost cost = 2; 425 repeated int64 version = 3; 426} 427 428message TouchRequest { 429 optional InternalHeader header = 10; 430 431 repeated Reference key = 1; 432 repeated CompositeIndex composite_index = 2; 433 optional bool force = 3 [default = false]; 434 repeated Snapshot snapshot = 9; 435} 436 437message TouchResponse { 438 optional Cost cost = 1; 439} 440 441message DeleteRequest { 442 optional InternalHeader header = 10; 443 444 repeated Reference key = 6; 445 optional Transaction transaction = 5; 446 447 optional bool trusted = 4 [default = false]; 448 449 optional bool force = 7 [default = false]; 450 451 optional bool mark_changes = 8 [default = false]; 452 repeated Snapshot snapshot = 9; 453} 454 455message DeleteResponse { 456 optional Cost cost = 1; 457 repeated int64 version = 3; 458} 459 460message NextRequest { 461 optional InternalHeader header = 5; 462 463 required Cursor cursor = 1; 464 optional int32 count = 2; 465 466 optional int32 offset = 4 [default = 0]; 467 468 optional bool compile = 3 [default = false]; 469} 470 471message QueryResult { 472 optional Cursor cursor = 1; 473 474 repeated EntityProto result = 2; 475 476 optional int32 skipped_results = 7; 477 478 required bool more_results = 3; 479 480 optional bool keys_only = 4; 481 482 optional bool index_only = 9; 483 484 optional bool small_ops = 10; 485 486 optional CompiledQuery compiled_query = 5; 487 488 optional CompiledCursor compiled_cursor = 6; 489 490 repeated CompositeIndex index = 8; 491 492 repeated int64 version = 11; 493} 494 495message AllocateIdsRequest { 496 optional InternalHeader header = 4; 497 498 optional Reference model_key = 1; 499 500 optional int64 size = 2; 501 502 optional int64 max = 3; 503 504 repeated Reference reserve = 5; 505} 506 507message AllocateIdsResponse { 508 required int64 start = 1; 509 required int64 end = 2; 510 optional Cost cost = 3; 511} 512 513message CompositeIndices { 514 repeated CompositeIndex index = 1; 515} 516 517message AddActionsRequest { 518 optional InternalHeader header = 3; 519 520 required Transaction transaction = 1; 521 repeated Action action = 2; 522} 523 524message AddActionsResponse { 525} 526 527message BeginTransactionRequest { 528 optional InternalHeader header = 3; 529 530 required string app = 1; 531 optional bool allow_multiple_eg = 2 [default = false]; 532 optional string database_id = 4; 533 534 enum TransactionMode { 535 UNKNOWN = 0; 536 READ_ONLY = 1; 537 READ_WRITE = 2; 538 } 539 optional TransactionMode mode = 5 [default = UNKNOWN]; 540 541 optional Transaction previous_transaction = 7; 542} 543 544message CommitResponse { 545 optional Cost cost = 1; 546 547 repeated group Version = 3 { 548 required Reference root_entity_key = 4; 549 required int64 version = 5; 550 } 551} 552