Skip to content

Commit dface90

Browse files
Prefix all LocalStore functions with localStore (#4191)
1 parent 44b5251 commit dface90

File tree

8 files changed

+232
-168
lines changed

8 files changed

+232
-168
lines changed

packages/firestore/src/core/bundle_impl.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import { LoadBundleTaskProgress } from '@firebase/firestore-types';
1919

2020
import { LocalStore } from '../local/local_store';
2121
import {
22-
applyBundleDocuments,
23-
saveNamedQuery
22+
localStoreApplyBundledDocuments,
23+
localStoreSaveNamedQuery
2424
} from '../local/local_store_impl';
2525
import { documentKeySet, DocumentKeySet } from '../model/collections';
2626
import { MaybeDocument, NoDocument } from '../model/document';
@@ -173,7 +173,7 @@ export class BundleLoader {
173173
);
174174
debugAssert(!!this.bundleMetadata.id, 'Bundle ID must be set.');
175175

176-
const changedDocuments = await applyBundleDocuments(
176+
const changedDocuments = await localStoreApplyBundledDocuments(
177177
this.localStore,
178178
new BundleConverterImpl(this.serializer),
179179
this.documents,
@@ -183,7 +183,11 @@ export class BundleLoader {
183183
const queryDocumentMap = this.getQueryDocumentMapping(this.documents);
184184

185185
for (const q of this.queries) {
186-
await saveNamedQuery(this.localStore, q, queryDocumentMap.get(q.name!));
186+
await localStoreSaveNamedQuery(
187+
this.localStore,
188+
q,
189+
queryDocumentMap.get(q.name!)
190+
);
187191
}
188192

189193
this.progress.taskState = 'Success';

packages/firestore/src/core/component_provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
import { LocalStore } from '../local/local_store';
2525
import {
2626
newLocalStore,
27-
synchronizeLastDocumentChangeReadTime
27+
localStoreSynchronizeLastDocumentChangeReadTime
2828
} from '../local/local_store_impl';
2929
import { LruParams } from '../local/lru_garbage_collector';
3030
import { LruScheduler } from '../local/lru_garbage_collector_impl';
@@ -172,7 +172,7 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro
172172

173173
async initialize(cfg: ComponentConfiguration): Promise<void> {
174174
await super.initialize(cfg);
175-
await synchronizeLastDocumentChangeReadTime(this.localStore);
175+
await localStoreSynchronizeLastDocumentChangeReadTime(this.localStore);
176176

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

packages/firestore/src/core/firestore_client.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ import {
2525
import { User } from '../auth/user';
2626
import { LocalStore } from '../local/local_store';
2727
import {
28-
executeQuery,
29-
getNamedQuery,
30-
handleUserChange,
31-
readLocalDocument
28+
localStoreExecuteQuery,
29+
localStoreGetNamedQuery,
30+
localStoreHandleUserChange,
31+
localStoreReadDocument
3232
} from '../local/local_store_impl';
3333
import { Persistence } from '../local/persistence';
3434
import { Document, NoDocument } from '../model/document';
@@ -202,7 +202,10 @@ export async function setOfflineComponentProvider(
202202
if (!currentUser.isEqual(user)) {
203203
currentUser = user;
204204
client.asyncQueue.enqueueRetryable(async () => {
205-
await handleUserChange(offlineComponentProvider.localStore, user);
205+
await localStoreHandleUserChange(
206+
offlineComponentProvider.localStore,
207+
user
208+
);
206209
});
207210
}
208211
});
@@ -495,7 +498,7 @@ async function readDocumentFromCache(
495498
result: Deferred<Document | null>
496499
): Promise<void> {
497500
try {
498-
const maybeDoc = await readLocalDocument(localStore, docKey);
501+
const maybeDoc = await localStoreReadDocument(localStore, docKey);
499502
if (maybeDoc instanceof Document) {
500503
result.resolve(maybeDoc);
501504
} else if (maybeDoc instanceof NoDocument) {
@@ -597,7 +600,7 @@ async function executeQueryFromCache(
597600
result: Deferred<ViewSnapshot>
598601
): Promise<void> {
599602
try {
600-
const queryResult = await executeQuery(
603+
const queryResult = await localStoreExecuteQuery(
601604
localStore,
602605
query,
603606
/* usePreviousResults= */ true
@@ -678,7 +681,7 @@ export function firestoreClientGetNamedQuery(
678681
queryName: string
679682
): Promise<NamedQuery | undefined> {
680683
return client.asyncQueue.enqueue(async () =>
681-
getNamedQuery(await getLocalStore(client), queryName)
684+
localStoreGetNamedQuery(await getLocalStore(client), queryName)
682685
);
683686
}
684687

0 commit comments

Comments
 (0)