common.proto 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2018 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. //
  15. syntax = "proto3";
  16. package google.firestore.v1;
  17. import "google/api/annotations.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.Firestore.V1Beta1";
  20. option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "CommonProto";
  23. option java_package = "com.google.firestore.v1";
  24. option objc_class_prefix = "GCFS";
  25. option php_namespace = "Google\\Cloud\\Firestore\\V1beta1";
  26. // A set of field paths on a document.
  27. // Used to restrict a get or update operation on a document to a subset of its
  28. // fields.
  29. // This is different from standard field masks, as this is always scoped to a
  30. // [Document][google.firestore.v1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1.Value].
  31. message DocumentMask {
  32. // The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
  33. // path syntax reference.
  34. repeated string field_paths = 1;
  35. }
  36. // A precondition on a document, used for conditional operations.
  37. message Precondition {
  38. // The type of precondition.
  39. oneof condition_type {
  40. // When set to `true`, the target document must exist.
  41. // When set to `false`, the target document must not exist.
  42. bool exists = 1;
  43. // When set, the target document must exist and have been last updated at
  44. // that time.
  45. google.protobuf.Timestamp update_time = 2;
  46. }
  47. }
  48. // Options for creating a new transaction.
  49. message TransactionOptions {
  50. // Options for a transaction that can be used to read and write documents.
  51. message ReadWrite {
  52. // An optional transaction to retry.
  53. bytes retry_transaction = 1;
  54. }
  55. // Options for a transaction that can only be used to read documents.
  56. message ReadOnly {
  57. // The consistency mode for this transaction. If not set, defaults to strong
  58. // consistency.
  59. oneof consistency_selector {
  60. // Reads documents at the given time.
  61. // This may not be older than 60 seconds.
  62. google.protobuf.Timestamp read_time = 2;
  63. }
  64. }
  65. // The mode of the transaction.
  66. oneof mode {
  67. // The transaction can only be used for read operations.
  68. ReadOnly read_only = 2;
  69. // The transaction can be used for both read and write operations.
  70. ReadWrite read_write = 3;
  71. }
  72. }