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