Skip to content

Commit b48223b

Browse files
Adding Master-Election
1 parent 630251e commit b48223b

15 files changed

+702
-213
lines changed

packages/firestore/src/core/firestore_client.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ export class FirestoreClient {
241241
const serializer = new JsonProtoSerializer(this.databaseInfo.databaseId, {
242242
useProto3Json: true
243243
});
244-
this.persistence = new IndexedDbPersistence(storagePrefix, serializer);
244+
this.persistence = new IndexedDbPersistence(
245+
storagePrefix,
246+
this.platform,
247+
serializer
248+
);
245249
return this.persistence.start();
246250
}
247251

packages/firestore/src/core/sync_engine.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class SyncEngine implements RemoteSyncer, PrimaryStateListener {
122122
[uidKey: string]: SortedMap<BatchId, Deferred<void>>;
123123
};
124124
private targetIdGenerator = TargetIdGenerator.forSyncEngine();
125-
private primaryClient = false;
125+
private isPrimary = false;
126126

127127
constructor(
128128
private localStore: LocalStore,
@@ -131,7 +131,7 @@ export class SyncEngine implements RemoteSyncer, PrimaryStateListener {
131131
) {}
132132

133133
get isPrimaryClient() {
134-
return this.primaryClient;
134+
return this.isPrimary;
135135
}
136136

137137
/** Subscribes view and error handler. Can be called only once. */
@@ -623,7 +623,8 @@ export class SyncEngine implements RemoteSyncer, PrimaryStateListener {
623623
});
624624
}
625625

626-
applyPrimaryState(primaryClient: boolean) {
627-
this.primaryClient = primaryClient;
626+
applyPrimaryState(primaryClient: boolean): void {
627+
// TODO(multitab): Apply the primary state internally on the AsyncQueue.
628+
this.isPrimary = primaryClient;
628629
}
629630
}

0 commit comments

Comments
 (0)