Skip to content

Commit d518f80

Browse files
Prefix all LocalStore functions with localStore
1 parent 566a62d commit d518f80

File tree

8 files changed

+231
-167
lines changed

8 files changed

+231
-167
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';
@@ -201,7 +201,10 @@ export async function setOfflineComponentProvider(
201201

202202
client.setCredentialChangeListener(user =>
203203
client.asyncQueue.enqueueRetryable(async () => {
204-
await handleUserChange(offlineComponentProvider.localStore, user);
204+
await localStoreHandleUserChange(
205+
offlineComponentProvider.localStore,
206+
user
207+
);
205208
})
206209
);
207210

@@ -493,7 +496,7 @@ async function readDocumentFromCache(
493496
result: Deferred<Document | null>
494497
): Promise<void> {
495498
try {
496-
const maybeDoc = await readLocalDocument(localStore, docKey);
499+
const maybeDoc = await localStoreReadDocument(localStore, docKey);
497500
if (maybeDoc instanceof Document) {
498501
result.resolve(maybeDoc);
499502
} else if (maybeDoc instanceof NoDocument) {
@@ -595,7 +598,7 @@ async function executeQueryFromCache(
595598
result: Deferred<ViewSnapshot>
596599
): Promise<void> {
597600
try {
598-
const queryResult = await executeQuery(
601+
const queryResult = await localStoreExecuteQuery(
599602
localStore,
600603
query,
601604
/* usePreviousResults= */ true
@@ -676,7 +679,7 @@ export function firestoreClientGetNamedQuery(
676679
queryName: string
677680
): Promise<NamedQuery | undefined> {
678681
return client.asyncQueue.enqueue(async () =>
679-
getNamedQuery(await getLocalStore(client), queryName)
682+
localStoreGetNamedQuery(await getLocalStore(client), queryName)
680683
);
681684
}
682685

0 commit comments

Comments
 (0)