From 4ec607bd375cddbec6d28bc1931eab7da221e4bb Mon Sep 17 00:00:00 2001 From: Google APIs Date: Wed, 9 Apr 2025 06:54:34 -0700 Subject: [PATCH] feat: new Firestore index modes and Database Editions PiperOrigin-RevId: 745570206 --- google/firestore/admin/v1/database.proto | 31 ++++++++++++++++ google/firestore/admin/v1/index.proto | 45 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/google/firestore/admin/v1/database.proto b/google/firestore/admin/v1/database.proto index 8161c65e8e..923b2169d3 100644 --- a/google/firestore/admin/v1/database.proto +++ b/google/firestore/admin/v1/database.proto @@ -227,6 +227,20 @@ message Database { } } + // The edition of the database. + enum DatabaseEdition { + // Not used. + DATABASE_EDITION_UNSPECIFIED = 0; + + // Standard edition. + // + // This is the default setting if not specified. + STANDARD = 1; + + // Enterprise edition. + ENTERPRISE = 2; + } + // The resource name of the Database. // Format: `projects/{project}/databases/{database}` string name = 1; @@ -314,8 +328,25 @@ message Database { // Output only. Information about the provenance of this database. SourceInfo source_info = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + // Output only. Background: Free tier is the ability of a Firestore database + // to use a small amount of resources every day without being charged. Once + // usage exceeds the free tier limit further usage is charged. + // + // Whether this database can make use of the free tier. Only one database + // per project can be eligible for the free tier. + // + // The first (or next) database that is created in a project without a free + // tier database will be marked as eligible for the free tier. Databases that + // are created while there is a free tier database will not be eligible for + // the free tier. + optional bool free_tier = 30 [(google.api.field_behavior) = OUTPUT_ONLY]; + // This checksum is computed by the server based on the value of other // fields, and may be sent on update and delete requests to ensure the // client has an up-to-date value before proceeding. string etag = 99; + + // Immutable. The edition of the database. + DatabaseEdition database_edition = 28 + [(google.api.field_behavior) = IMMUTABLE]; } diff --git a/google/firestore/admin/v1/index.proto b/google/firestore/admin/v1/index.proto index eddc2eec8b..5dd4dc9fb9 100644 --- a/google/firestore/admin/v1/index.proto +++ b/google/firestore/admin/v1/index.proto @@ -66,6 +66,9 @@ message Index { // The index can only be used by the Firestore in Datastore Mode query API. DATASTORE_MODE_API = 1; + + // The index can only be used by the MONGODB_COMPATIBLE_API. + MONGODB_COMPATIBLE_API = 2; } // A field in an index. @@ -162,6 +165,32 @@ message Index { NEEDS_REPAIR = 3; } + // The density configuration for the index. + enum Density { + // Unspecified. It will use database default setting. This value is input + // only. + DENSITY_UNSPECIFIED = 0; + + // In order for an index entry to be added, the document must + // contain all fields specified in the index. + // + // This is the only allowed value for indexes having ApiScope `ANY_API` and + // `DATASTORE_MODE_API`. + SPARSE_ALL = 1; + + // In order for an index entry to be added, the document must + // contain at least one of the fields specified in the index. + // Non-existent fields are treated as having a NULL value when generating + // index entries. + SPARSE_ANY = 2; + + // An index entry will be added regardless of whether the + // document contains any of the fields specified in the index. + // Non-existent fields are treated as having a NULL value when generating + // index entries. + DENSE = 3; + } + // Output only. A server defined name for this index. // The form of this name for composite indexes will be: // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` @@ -195,4 +224,20 @@ message Index { // Output only. The serving state of the index. State state = 4; + + // Immutable. The density configuration of the index. + Density density = 6 [(google.api.field_behavior) = IMMUTABLE]; + + // Optional. Whether the index is multikey. By default, the index is not + // multikey. For non-multikey indexes, none of the paths in the index + // definition reach or traverse an array, except via an explicit array index. + // For multikey indexes, at most one of the paths in the index definition + // reach or traverse an array, except via an explicit array index. Violations + // will result in errors. + // + // Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope. + bool multikey = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The number of shards for the index. + int32 shard_count = 8 [(google.api.field_behavior) = OPTIONAL]; }