Skip to content

Commit

Permalink
Synchronize protos (#6369)
Browse files Browse the repository at this point in the history
This is a result of comparison with official Firestore protos.

Note, some gRPC endpoint and message additions were omitted since we
have no plans of supporting them in SDK.
  • Loading branch information
tom-andersen authored Oct 11, 2024
1 parent 0b1582a commit 60a5e4c
Show file tree
Hide file tree
Showing 8 changed files with 515 additions and 294 deletions.
1 change: 1 addition & 0 deletions firebase-firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Unreleased
* [changed] Update Firestore proto definitions. [#6369](//github.com/firebase/firebase-android-sdk/pull/6369)
* [changed] Updated protobuf dependency to `3.25.5` to fix
[CVE-2024-7254](https://github.com/advisories/GHSA-735f-pc8j-v9w8).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@ package google.firestore.v1;
import "google/firestore/v1/document.proto";

option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "AggregationResultProto";
option java_package = "com.google.firestore.v1";
Expand All @@ -35,7 +35,8 @@ option ruby_package = "Google::Cloud::Firestore::V1";
message AggregationResult {
// The result of the aggregation functions, ex: `COUNT(*) AS total_docs`.
//
// The key is the [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
// The key is the
// [alias][google.firestore.v1.StructuredAggregationQuery.Aggregation.alias]
// assigned to the aggregation function on input and the size of this map
// equals the number of aggregation functions in the query.
map<string, Value> aggregate_fields = 2;
Expand Down
26 changes: 13 additions & 13 deletions firebase-firestore/src/proto/google/firestore/v1/bloom_filter.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Google LLC
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@ syntax = "proto3";
package google.firestore.v1;

option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "BloomFilterProto";
option java_package = "com.google.firestore.v1";
Expand All @@ -32,21 +32,21 @@ option ruby_package = "Google::Cloud::Firestore::V1";
// defines the number of bits of the last byte to be ignored as "padding". The
// values of these "padding" bits are unspecified and must be ignored.
//
// To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0.
// To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0.
// To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0.
// To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0.
// To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0.
// To retrieve the first bit, bit 0, calculate: `(bitmap[0] & 0x01) != 0`.
// To retrieve the second bit, bit 1, calculate: `(bitmap[0] & 0x02) != 0`.
// To retrieve the third bit, bit 2, calculate: `(bitmap[0] & 0x04) != 0`.
// To retrieve the fourth bit, bit 3, calculate: `(bitmap[0] & 0x08) != 0`.
// To retrieve bit n, calculate: `(bitmap[n / 8] & (0x01 << (n % 8))) != 0`.
//
// The "size" of a `BitSequence` (the number of bits it contains) is calculated
// by this formula: (bitmap.length * 8) - padding.
// by this formula: `(bitmap.length * 8) - padding`.
message BitSequence {
// The bytes that encode the bit sequence.
// May have a length of zero.
bytes bitmap = 1;

// The number of bits of the last byte in `bitmap` to ignore as "padding".
// If the length of `bitmap` is zero, then this value must be 0.
// If the length of `bitmap` is zero, then this value must be `0`.
// Otherwise, this value must be between 0 and 7, inclusive.
int32 padding = 2;
}
Expand All @@ -57,10 +57,10 @@ message BitSequence {
// hash as 2 distinct 64-bit hash values, interpreted as unsigned integers
// using 2's complement encoding.
//
// These two hash values, named h1 and h2, are then used to compute the
// `hash_count` hash values using the formula, starting at i=0:
// These two hash values, named `h1` and `h2`, are then used to compute the
// `hash_count` hash values using the formula, starting at `i=0`:
//
// h(i) = h1 + (i * h2)
// h(i) = h1 + (i * h2)
//
// These resulting values are then taken modulo the number of bits in the bloom
// filter to get the bits of the bloom filter to test for the given entry.
Expand All @@ -70,4 +70,4 @@ message BloomFilter {

// The number of hashes used by the algorithm.
int32 hash_count = 2;
}
}
26 changes: 16 additions & 10 deletions firebase-firestore/src/proto/google/firestore/v1/common.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC.
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,32 +11,32 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.firestore.v1;

import "google/api/annotations.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "CommonProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";

option ruby_package = "Google::Cloud::Firestore::V1";

// A set of field paths on a document.
// Used to restrict a get or update operation on a document to a subset of its
// fields.
// This is different from standard field masks, as this is always scoped to a
// [Document][google.firestore.v1.Document], and takes in account the dynamic nature of [Value][google.firestore.v1.Value].
// [Document][google.firestore.v1.Document], and takes in account the dynamic
// nature of [Value][google.firestore.v1.Value].
message DocumentMask {
// The list of field paths in the mask. See [Document.fields][google.firestore.v1.Document.fields] for a field
// path syntax reference.
// The list of field paths in the mask. See
// [Document.fields][google.firestore.v1.Document.fields] for a field path
// syntax reference.
repeated string field_paths = 1;
}

Expand All @@ -49,14 +49,17 @@ message Precondition {
bool exists = 1;

// When set, the target document must exist and have been last updated at
// that time.
// that time. Timestamp must be microsecond aligned.
google.protobuf.Timestamp update_time = 2;
}
}

// Options for creating a new transaction.
message TransactionOptions {
// Options for a transaction that can be used to read and write documents.
//
// Firestore does not allow 3rd party auth requests to create read-write.
// transactions.
message ReadWrite {
// An optional transaction to retry.
bytes retry_transaction = 1;
Expand All @@ -68,7 +71,10 @@ message TransactionOptions {
// consistency.
oneof consistency_selector {
// Reads documents at the given time.
// This may not be older than 60 seconds.
//
// This must be a microsecond precision timestamp within the past one
// hour, or if Point-in-Time Recovery is enabled, can additionally be a
// whole minute timestamp within the past 7 days.
google.protobuf.Timestamp read_time = 2;
}
}
Expand Down
35 changes: 17 additions & 18 deletions firebase-firestore/src/proto/google/firestore/v1/document.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 Google LLC.
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -11,25 +11,24 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

syntax = "proto3";

package google.firestore.v1;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "google/type/latlng.proto";

option csharp_namespace = "Google.Cloud.Firestore.V1";
option go_package = "google.golang.org/genproto/googleapis/firestore/v1;firestore";
option go_package = "cloud.google.com/go/firestore/apiv1/firestorepb;firestorepb";
option java_multiple_files = true;
option java_outer_classname = "DocumentProto";
option java_package = "com.google.firestore.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\V1";

option ruby_package = "Google::Cloud::Firestore::V1";

// A Firestore document.
//
Expand All @@ -43,23 +42,23 @@ message Document {
//
// The map keys represent field names.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Field names matching the regular expression `__.*__` are reserved. Reserved
// field names are forbidden except in certain documented contexts. The map
// keys, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// field names are forbidden except in certain documented contexts. The field
// names, represented as UTF-8, must not exceed 1,500 bytes and cannot be
// empty.
//
// Field paths may be used in other contexts to refer to structured fields
// defined here. For `map_value`, the field path is represented by the simple
// or quoted field names of the containing fields, delimited by `.`. For
// example, the structured field
// `"foo" : { map_value: { "x&y" : { string_value: "hello" }}}` would be
// represented by the field path `foo.x&y`.
// defined here. For `map_value`, the field path is represented by a
// dot-delimited (`.`) string of segments. Each segment is either a simple
// field name (defined below) or a quoted field name. For example, the
// structured field `"foo" : { map_value: { "x&y" : { string_value: "hello"
// }}}` would be represented by the field path `` foo.`x&y` ``.
//
// A simple field name contains only characters `a` to `z`, `A` to `Z`,
// `0` to `9`, or `_`, and must not start with `0` to `9`. For example,
// `foo_bar_17`.
//
// Within a field path, a quoted field name starts and ends with `` ` `` and
// A quoted field name starts and ends with `` ` `` and
// may contain any character. Some characters, including `` ` ``, must be
// escaped using a `\`. For example, `` `x&y` `` represents `x&y` and
// `` `bak\`tik` `` represents `` bak`tik ``.
Expand Down Expand Up @@ -124,7 +123,7 @@ message Value {

// An array value.
//
// Cannot directly contain another array value, though can contain an
// Cannot directly contain another array value, though can contain a
// map which contains another array.
ArrayValue array_value = 9;

Expand Down
Loading

0 comments on commit 60a5e4c

Please sign in to comment.