Skip to content

Commit e4e7663

Browse files
Prefix syncEngine methods
1 parent bd72f9f commit e4e7663

File tree

4 files changed

+149
-128
lines changed

4 files changed

+149
-128
lines changed

packages/firestore/src/core/component_provider.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ import { Code, FirestoreError } from '../util/error';
5858
import { DatabaseInfo } from './database_info';
5959
import { EventManager, newEventManager } from './event_manager';
6060
import { SyncEngine } from './sync_engine';
61-
import { OnlineStateSource } from './types';
6261
import {
63-
applyActiveTargetsChange,
64-
applyBatchState,
65-
applyOnlineStateChange,
66-
applyPrimaryState,
67-
applyTargetState,
68-
ensureWriteCallbacks,
69-
getActiveClients,
62+
syncEngineApplyActiveTargetsChange,
63+
syncEngineApplyBatchState,
64+
syncEngineApplyOnlineStateChange,
65+
syncEngineApplyPrimaryState,
66+
syncEngineApplyTargetState,
67+
syncEngineEnsureWriteCallbacks,
68+
syncEngineGetActiveClients,
7069
newSyncEngine,
7170
syncEngineHandleCredentialChange,
72-
synchronizeWithChangedDocuments
71+
syncEngineSynchronizeWithChangedDocuments
7372
} from './sync_engine_impl';
73+
import { OnlineStateSource } from './types';
7474

7575
export interface ComponentConfiguration {
7676
asyncQueue: AsyncQueue;
@@ -177,7 +177,9 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro
177177
await this.onlineComponentProvider.initialize(this, cfg);
178178

179179
// Enqueue writes from a previous session
180-
await ensureWriteCallbacks(this.onlineComponentProvider.syncEngine);
180+
await syncEngineEnsureWriteCallbacks(
181+
this.onlineComponentProvider.syncEngine
182+
);
181183
await fillWritePipeline(this.onlineComponentProvider.remoteStore);
182184
}
183185

@@ -252,14 +254,14 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
252254

253255
if (this.sharedClientState instanceof WebStorageSharedClientState) {
254256
this.sharedClientState.syncEngine = {
255-
applyBatchState: applyBatchState.bind(null, syncEngine),
256-
applyTargetState: applyTargetState.bind(null, syncEngine),
257-
applyActiveTargetsChange: applyActiveTargetsChange.bind(
257+
applyBatchState: syncEngineApplyBatchState.bind(null, syncEngine),
258+
applyTargetState: syncEngineApplyTargetState.bind(null, syncEngine),
259+
applyActiveTargetsChange: syncEngineApplyActiveTargetsChange.bind(
258260
null,
259261
syncEngine
260262
),
261-
getActiveClients: getActiveClients.bind(null, syncEngine),
262-
synchronizeWithChangedDocuments: synchronizeWithChangedDocuments.bind(
263+
getActiveClients: syncEngineGetActiveClients.bind(null, syncEngine),
264+
synchronizeWithChangedDocuments: syncEngineSynchronizeWithChangedDocuments.bind(
263265
null,
264266
syncEngine
265267
)
@@ -270,7 +272,7 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
270272
// NOTE: This will immediately call the listener, so we make sure to
271273
// set it after localStore / remoteStore are started.
272274
await this.persistence.setPrimaryStateListener(async isPrimary => {
273-
await applyPrimaryState(
275+
await syncEngineApplyPrimaryState(
274276
this.onlineComponentProvider.syncEngine,
275277
isPrimary
276278
);
@@ -339,7 +341,7 @@ export class OnlineComponentProvider {
339341
);
340342

341343
this.sharedClientState.onlineStateHandler = onlineState =>
342-
applyOnlineStateChange(
344+
syncEngineApplyOnlineStateChange(
343345
this.syncEngine,
344346
onlineState,
345347
OnlineStateSource.SharedClientState
@@ -372,7 +374,7 @@ export class OnlineComponentProvider {
372374
this.datastore,
373375
cfg.asyncQueue,
374376
onlineState =>
375-
applyOnlineStateChange(
377+
syncEngineApplyOnlineStateChange(
376378
this.syncEngine,
377379
onlineState,
378380
OnlineStateSource.RemoteStore

packages/firestore/src/core/firestore_client.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,17 @@ import {
7474
} from './event_manager';
7575
import { newQueryForPath, Query } from './query';
7676
import { SyncEngine } from './sync_engine';
77-
import { Transaction } from './transaction';
78-
import { TransactionRunner } from './transaction_runner';
79-
import { View } from './view';
80-
import { ViewSnapshot } from './view_snapshot';
8177
import {
82-
registerPendingWritesCallback,
78+
syncEngineRegisterPendingWritesCallback,
8379
syncEngineListen,
8480
syncEngineLoadBundle,
8581
syncEngineUnlisten,
8682
syncEngineWrite
8783
} from './sync_engine_impl';
84+
import { Transaction } from './transaction';
85+
import { TransactionRunner } from './transaction_runner';
86+
import { View } from './view';
87+
import { ViewSnapshot } from './view_snapshot';
8888

8989
const LOG_TAG = 'FirestoreClient';
9090
export const MAX_CONCURRENT_LIMBO_RESOLUTIONS = 100;
@@ -342,7 +342,7 @@ export function firestoreClientWaitForPendingWrites(
342342
const deferred = new Deferred<void>();
343343
client.asyncQueue.enqueueAndForget(async () => {
344344
const syncEngine = await getSyncEngine(client);
345-
return registerPendingWritesCallback(syncEngine, deferred);
345+
return syncEngineRegisterPendingWritesCallback(syncEngine, deferred);
346346
});
347347
return deferred.promise;
348348
}

0 commit comments

Comments
 (0)