Skip to content

Prefix all LocalStore functions with localStore #4191

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

Merged
merged 4 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 8 additions & 4 deletions packages/firestore/src/core/bundle_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import { LoadBundleTaskProgress } from '@firebase/firestore-types';

import { LocalStore } from '../local/local_store';
import {
applyBundleDocuments,
saveNamedQuery
localStoreApplyBundledDocuments,
localStoreSaveNamedQuery
} from '../local/local_store_impl';
import { documentKeySet, DocumentKeySet } from '../model/collections';
import { MaybeDocument, NoDocument } from '../model/document';
Expand Down Expand Up @@ -173,7 +173,7 @@ export class BundleLoader {
);
debugAssert(!!this.bundleMetadata.id, 'Bundle ID must be set.');

const changedDocuments = await applyBundleDocuments(
const changedDocuments = await localStoreApplyBundledDocuments(
this.localStore,
new BundleConverterImpl(this.serializer),
this.documents,
Expand All @@ -183,7 +183,11 @@ export class BundleLoader {
const queryDocumentMap = this.getQueryDocumentMapping(this.documents);

for (const q of this.queries) {
await saveNamedQuery(this.localStore, q, queryDocumentMap.get(q.name!));
await localStoreSaveNamedQuery(
this.localStore,
q,
queryDocumentMap.get(q.name!)
);
}

this.progress.taskState = 'Success';
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/src/core/component_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import { LocalStore } from '../local/local_store';
import {
newLocalStore,
synchronizeLastDocumentChangeReadTime
localStoreSynchronizeLastDocumentChangeReadTime
} from '../local/local_store_impl';
import { LruParams } from '../local/lru_garbage_collector';
import { LruScheduler } from '../local/lru_garbage_collector_impl';
Expand Down Expand Up @@ -172,7 +172,7 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro

async initialize(cfg: ComponentConfiguration): Promise<void> {
await super.initialize(cfg);
await synchronizeLastDocumentChangeReadTime(this.localStore);
await localStoreSynchronizeLastDocumentChangeReadTime(this.localStore);

await this.onlineComponentProvider.initialize(this, cfg);

Expand Down
19 changes: 11 additions & 8 deletions packages/firestore/src/core/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import {
import { User } from '../auth/user';
import { LocalStore } from '../local/local_store';
import {
executeQuery,
getNamedQuery,
handleUserChange,
readLocalDocument
localStoreExecuteQuery,
localStoreGetNamedQuery,
localStoreHandleUserChange,
localStoreReadDocument
} from '../local/local_store_impl';
import { Persistence } from '../local/persistence';
import { Document, NoDocument } from '../model/document';
Expand Down Expand Up @@ -202,7 +202,10 @@ export async function setOfflineComponentProvider(
if (!currentUser.isEqual(user)) {
currentUser = user;
client.asyncQueue.enqueueRetryable(async () => {
await handleUserChange(offlineComponentProvider.localStore, user);
await localStoreHandleUserChange(
offlineComponentProvider.localStore,
user
);
});
}
});
Expand Down Expand Up @@ -495,7 +498,7 @@ async function readDocumentFromCache(
result: Deferred<Document | null>
): Promise<void> {
try {
const maybeDoc = await readLocalDocument(localStore, docKey);
const maybeDoc = await localStoreReadDocument(localStore, docKey);
if (maybeDoc instanceof Document) {
result.resolve(maybeDoc);
} else if (maybeDoc instanceof NoDocument) {
Expand Down Expand Up @@ -597,7 +600,7 @@ async function executeQueryFromCache(
result: Deferred<ViewSnapshot>
): Promise<void> {
try {
const queryResult = await executeQuery(
const queryResult = await localStoreExecuteQuery(
localStore,
query,
/* usePreviousResults= */ true
Expand Down Expand Up @@ -678,7 +681,7 @@ export function firestoreClientGetNamedQuery(
queryName: string
): Promise<NamedQuery | undefined> {
return client.asyncQueue.enqueue(async () =>
getNamedQuery(await getLocalStore(client), queryName)
localStoreGetNamedQuery(await getLocalStore(client), queryName)
);
}

Expand Down
Loading