Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteDocumentCache APIs for Indexing #5988

Merged
merged 7 commits into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-dolphins-breathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

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 `enablIndexedDbPersistence()`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in line 5, needs another 'e', should be enableIndexedDbPersistence().

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egilmorez ... Talked to sebastian, and these changes are internal-only, no user-breaking effects. Thanks for adding me to the review.

@schmidt-sebastian ... Please feel free to include me in Firestore PRs, all platforms, especially the PRs that touch public-facing reference docs. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

1 change: 1 addition & 0 deletions packages/firestore/externs.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"packages/firestore/src/protos/firestore_proto_api.ts",
"packages/firestore/src/util/error.ts",
"packages/firestore/src/local/indexeddb_schema.ts",
"packages/firestore/src/local/indexeddb_schema_legacy.ts",
"packages/firestore/src/local/shared_client_state_schema.ts"
]
}
4 changes: 4 additions & 0 deletions packages/firestore/src/core/snapshot_version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export class SnapshotVersion {
return new SnapshotVersion(new Timestamp(0, 0));
}

static max(): SnapshotVersion {
return new SnapshotVersion(new Timestamp(253402300799, 1e9 - 1));
}

private constructor(private timestamp: Timestamp) {}

compareTo(other: SnapshotVersion): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
DbMutationBatch,
DbRemoteDocument
} from './indexeddb_schema';
import { DbRemoteDocument as DbRemoteDocumentLegacy } from './indexeddb_schema_legacy';
import {
DbDocumentMutationKey,
DbDocumentMutationStore,
Expand Down Expand Up @@ -84,7 +85,9 @@ export function removeMutationBatch(
/**
* Returns an approximate size for the given document.
*/
export function dbDocumentSize(doc: DbRemoteDocument | null): number {
export function dbDocumentSize(
doc: DbRemoteDocument | DbRemoteDocumentLegacy | null
): number {
if (!doc) {
return 0;
}
Expand Down
Loading