Skip to content

Commit 69aa7b0

Browse files
RemoteDocumentCache APIs for Indexing (#5988)
1 parent 911c028 commit 69aa7b0

21 files changed

+815
-289
lines changed

.changeset/seven-dolphins-breathe.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
The format of some of the IndexedDB data changed. This increases the performance of document lookups after an initial migration. If you do not want to migrate data, you can call `clearIndexedDbPersistence()` before invoking `enableIndexedDbPersistence()`.

packages/firestore/externs.json

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"packages/firestore/src/protos/firestore_proto_api.ts",
3535
"packages/firestore/src/util/error.ts",
3636
"packages/firestore/src/local/indexeddb_schema.ts",
37+
"packages/firestore/src/local/indexeddb_schema_legacy.ts",
3738
"packages/firestore/src/local/shared_client_state_schema.ts"
3839
]
3940
}

packages/firestore/src/core/snapshot_version.ts

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export class SnapshotVersion {
3030
return new SnapshotVersion(new Timestamp(0, 0));
3131
}
3232

33+
static max(): SnapshotVersion {
34+
return new SnapshotVersion(new Timestamp(253402300799, 1e9 - 1));
35+
}
36+
3337
private constructor(private timestamp: Timestamp) {}
3438

3539
compareTo(other: SnapshotVersion): number {

packages/firestore/src/local/indexeddb_mutation_batch_impl.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
DbMutationBatch,
2424
DbRemoteDocument
2525
} from './indexeddb_schema';
26+
import { DbRemoteDocument as DbRemoteDocumentLegacy } from './indexeddb_schema_legacy';
2627
import {
2728
DbDocumentMutationKey,
2829
DbDocumentMutationStore,
@@ -84,7 +85,9 @@ export function removeMutationBatch(
8485
/**
8586
* Returns an approximate size for the given document.
8687
*/
87-
export function dbDocumentSize(doc: DbRemoteDocument | null): number {
88+
export function dbDocumentSize(
89+
doc: DbRemoteDocument | DbRemoteDocumentLegacy | null
90+
): number {
8891
if (!doc) {
8992
return 0;
9093
}

0 commit comments

Comments
 (0)