Skip to content

Commit 4ec607b

Browse files
Google APIscopybara-github
authored andcommitted
feat: new Firestore index modes and Database Editions
PiperOrigin-RevId: 745570206
1 parent 87e84cb commit 4ec607b

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

google/firestore/admin/v1/database.proto

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,20 @@ message Database {
227227
}
228228
}
229229

230+
// The edition of the database.
231+
enum DatabaseEdition {
232+
// Not used.
233+
DATABASE_EDITION_UNSPECIFIED = 0;
234+
235+
// Standard edition.
236+
//
237+
// This is the default setting if not specified.
238+
STANDARD = 1;
239+
240+
// Enterprise edition.
241+
ENTERPRISE = 2;
242+
}
243+
230244
// The resource name of the Database.
231245
// Format: `projects/{project}/databases/{database}`
232246
string name = 1;
@@ -314,8 +328,25 @@ message Database {
314328
// Output only. Information about the provenance of this database.
315329
SourceInfo source_info = 26 [(google.api.field_behavior) = OUTPUT_ONLY];
316330

331+
// Output only. Background: Free tier is the ability of a Firestore database
332+
// to use a small amount of resources every day without being charged. Once
333+
// usage exceeds the free tier limit further usage is charged.
334+
//
335+
// Whether this database can make use of the free tier. Only one database
336+
// per project can be eligible for the free tier.
337+
//
338+
// The first (or next) database that is created in a project without a free
339+
// tier database will be marked as eligible for the free tier. Databases that
340+
// are created while there is a free tier database will not be eligible for
341+
// the free tier.
342+
optional bool free_tier = 30 [(google.api.field_behavior) = OUTPUT_ONLY];
343+
317344
// This checksum is computed by the server based on the value of other
318345
// fields, and may be sent on update and delete requests to ensure the
319346
// client has an up-to-date value before proceeding.
320347
string etag = 99;
348+
349+
// Immutable. The edition of the database.
350+
DatabaseEdition database_edition = 28
351+
[(google.api.field_behavior) = IMMUTABLE];
321352
}

google/firestore/admin/v1/index.proto

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ message Index {
6666

6767
// The index can only be used by the Firestore in Datastore Mode query API.
6868
DATASTORE_MODE_API = 1;
69+
70+
// The index can only be used by the MONGODB_COMPATIBLE_API.
71+
MONGODB_COMPATIBLE_API = 2;
6972
}
7073

7174
// A field in an index.
@@ -162,6 +165,32 @@ message Index {
162165
NEEDS_REPAIR = 3;
163166
}
164167

168+
// The density configuration for the index.
169+
enum Density {
170+
// Unspecified. It will use database default setting. This value is input
171+
// only.
172+
DENSITY_UNSPECIFIED = 0;
173+
174+
// In order for an index entry to be added, the document must
175+
// contain all fields specified in the index.
176+
//
177+
// This is the only allowed value for indexes having ApiScope `ANY_API` and
178+
// `DATASTORE_MODE_API`.
179+
SPARSE_ALL = 1;
180+
181+
// In order for an index entry to be added, the document must
182+
// contain at least one of the fields specified in the index.
183+
// Non-existent fields are treated as having a NULL value when generating
184+
// index entries.
185+
SPARSE_ANY = 2;
186+
187+
// An index entry will be added regardless of whether the
188+
// document contains any of the fields specified in the index.
189+
// Non-existent fields are treated as having a NULL value when generating
190+
// index entries.
191+
DENSE = 3;
192+
}
193+
165194
// Output only. A server defined name for this index.
166195
// The form of this name for composite indexes will be:
167196
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}`
@@ -195,4 +224,20 @@ message Index {
195224

196225
// Output only. The serving state of the index.
197226
State state = 4;
227+
228+
// Immutable. The density configuration of the index.
229+
Density density = 6 [(google.api.field_behavior) = IMMUTABLE];
230+
231+
// Optional. Whether the index is multikey. By default, the index is not
232+
// multikey. For non-multikey indexes, none of the paths in the index
233+
// definition reach or traverse an array, except via an explicit array index.
234+
// For multikey indexes, at most one of the paths in the index definition
235+
// reach or traverse an array, except via an explicit array index. Violations
236+
// will result in errors.
237+
//
238+
// Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.
239+
bool multikey = 7 [(google.api.field_behavior) = OPTIONAL];
240+
241+
// Optional. The number of shards for the index.
242+
int32 shard_count = 8 [(google.api.field_behavior) = OPTIONAL];
198243
}

0 commit comments

Comments
 (0)