Skip to content

SyncEngine move/renames #4196

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 3 commits into from
Dec 14, 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
42 changes: 22 additions & 20 deletions packages/firestore/src/core/component_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,19 @@ import { Code, FirestoreError } from '../util/error';

import { DatabaseInfo } from './database_info';
import { EventManager, newEventManager } from './event_manager';
import { SyncEngine } from './sync_engine';
import {
applyActiveTargetsChange,
applyBatchState,
applyOnlineStateChange,
applyPrimaryState,
applyTargetState,
getActiveClients,
syncEngineHandleCredentialChange,
newSyncEngine,
SyncEngine,
ensureWriteCallbacks,
synchronizeWithChangedDocuments
} from './sync_engine';
syncEngineApplyActiveTargetsChange,
syncEngineApplyBatchState,
syncEngineApplyOnlineStateChange,
syncEngineApplyPrimaryState,
syncEngineApplyTargetState,
syncEngineEnsureWriteCallbacks,
syncEngineGetActiveClients,
syncEngineHandleCredentialChange,
syncEngineSynchronizeWithChangedDocuments
} from './sync_engine_impl';
import { OnlineStateSource } from './types';

export interface ComponentConfiguration {
Expand Down Expand Up @@ -177,7 +177,9 @@ export class IndexedDbOfflineComponentProvider extends MemoryOfflineComponentPro
await this.onlineComponentProvider.initialize(this, cfg);

// Enqueue writes from a previous session
await ensureWriteCallbacks(this.onlineComponentProvider.syncEngine);
await syncEngineEnsureWriteCallbacks(
this.onlineComponentProvider.syncEngine
);
await fillWritePipeline(this.onlineComponentProvider.remoteStore);
}

Expand Down Expand Up @@ -252,14 +254,14 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP

if (this.sharedClientState instanceof WebStorageSharedClientState) {
this.sharedClientState.syncEngine = {
applyBatchState: applyBatchState.bind(null, syncEngine),
applyTargetState: applyTargetState.bind(null, syncEngine),
applyActiveTargetsChange: applyActiveTargetsChange.bind(
applyBatchState: syncEngineApplyBatchState.bind(null, syncEngine),
applyTargetState: syncEngineApplyTargetState.bind(null, syncEngine),
applyActiveTargetsChange: syncEngineApplyActiveTargetsChange.bind(
null,
syncEngine
),
getActiveClients: getActiveClients.bind(null, syncEngine),
synchronizeWithChangedDocuments: synchronizeWithChangedDocuments.bind(
getActiveClients: syncEngineGetActiveClients.bind(null, syncEngine),
synchronizeWithChangedDocuments: syncEngineSynchronizeWithChangedDocuments.bind(
null,
syncEngine
)
Expand All @@ -270,7 +272,7 @@ export class MultiTabOfflineComponentProvider extends IndexedDbOfflineComponentP
// NOTE: This will immediately call the listener, so we make sure to
// set it after localStore / remoteStore are started.
await this.persistence.setPrimaryStateListener(async isPrimary => {
await applyPrimaryState(
await syncEngineApplyPrimaryState(
this.onlineComponentProvider.syncEngine,
isPrimary
);
Expand Down Expand Up @@ -339,7 +341,7 @@ export class OnlineComponentProvider {
);

this.sharedClientState.onlineStateHandler = onlineState =>
applyOnlineStateChange(
syncEngineApplyOnlineStateChange(
this.syncEngine,
onlineState,
OnlineStateSource.SharedClientState
Expand Down Expand Up @@ -372,7 +374,7 @@ export class OnlineComponentProvider {
this.datastore,
cfg.asyncQueue,
onlineState =>
applyOnlineStateChange(
syncEngineApplyOnlineStateChange(
this.syncEngine,
onlineState,
OnlineStateSource.RemoteStore
Expand Down
8 changes: 4 additions & 4 deletions packages/firestore/src/core/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ import {
removeSnapshotsInSyncListener
} from './event_manager';
import { newQueryForPath, Query } from './query';
import { SyncEngine } from './sync_engine';
import {
registerPendingWritesCallback,
SyncEngine,
syncEngineRegisterPendingWritesCallback,
syncEngineListen,
syncEngineLoadBundle,
syncEngineUnlisten,
syncEngineWrite
} from './sync_engine';
} from './sync_engine_impl';
import { Transaction } from './transaction';
import { TransactionRunner } from './transaction_runner';
import { View } from './view';
Expand Down Expand Up @@ -342,7 +342,7 @@ export function firestoreClientWaitForPendingWrites(
const deferred = new Deferred<void>();
client.asyncQueue.enqueueAndForget(async () => {
const syncEngine = await getSyncEngine(client);
return registerPendingWritesCallback(syncEngine, deferred);
return syncEngineRegisterPendingWritesCallback(syncEngine, deferred);
});
return deferred.promise;
}
Expand Down
Loading