Skip to content

Commit 0abaa11

Browse files
Merge the Index Engines
1 parent 9466242 commit 0abaa11

File tree

16 files changed

+406
-427
lines changed

16 files changed

+406
-427
lines changed

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/remote/RemoteStoreTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
import com.google.firebase.database.collection.ImmutableSortedSet;
2222
import com.google.firebase.firestore.auth.User;
2323
import com.google.firebase.firestore.core.OnlineState;
24-
import com.google.firebase.firestore.local.DefaultQueryEngine;
2524
import com.google.firebase.firestore.local.IndexBackfiller;
2625
import com.google.firebase.firestore.local.LocalStore;
2726
import com.google.firebase.firestore.local.MemoryPersistence;
2827
import com.google.firebase.firestore.local.Persistence;
28+
import com.google.firebase.firestore.local.QueryEngine;
2929
import com.google.firebase.firestore.model.DocumentKey;
3030
import com.google.firebase.firestore.model.mutation.MutationBatchResult;
3131
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
@@ -76,7 +76,7 @@ public ImmutableSortedSet<DocumentKey> getRemoteKeysForTarget(int targetId) {
7676
};
7777

7878
FakeConnectivityMonitor connectivityMonitor = new FakeConnectivityMonitor();
79-
DefaultQueryEngine queryEngine = new DefaultQueryEngine();
79+
QueryEngine queryEngine = new QueryEngine();
8080
Persistence persistence = MemoryPersistence.createEagerGcMemoryPersistence();
8181
persistence.start();
8282
IndexBackfiller indexBackfiller = new IndexBackfiller(persistence, new AsyncQueue());

firebase-firestore/src/main/java/com/google/firebase/firestore/core/MemoryComponentProvider.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
import androidx.annotation.Nullable;
1818
import com.google.firebase.database.collection.ImmutableSortedSet;
19-
import com.google.firebase.firestore.local.DefaultQueryEngine;
2019
import com.google.firebase.firestore.local.IndexBackfiller;
2120
import com.google.firebase.firestore.local.LocalStore;
2221
import com.google.firebase.firestore.local.MemoryPersistence;
2322
import com.google.firebase.firestore.local.Persistence;
23+
import com.google.firebase.firestore.local.QueryEngine;
2424
import com.google.firebase.firestore.local.Scheduler;
2525
import com.google.firebase.firestore.model.DocumentKey;
2626
import com.google.firebase.firestore.model.mutation.MutationBatchResult;
@@ -54,10 +54,7 @@ protected EventManager createEventManager(Configuration configuration) {
5454
@Override
5555
protected LocalStore createLocalStore(Configuration configuration) {
5656
return new LocalStore(
57-
getPersistence(),
58-
getIndexBackfiller(),
59-
new DefaultQueryEngine(),
60-
configuration.getInitialUser());
57+
getPersistence(), getIndexBackfiller(), new QueryEngine(), configuration.getInitialUser());
6158
}
6259

6360
@Override

firebase-firestore/src/main/java/com/google/firebase/firestore/local/DefaultQueryEngine.java

Lines changed: 0 additions & 175 deletions
This file was deleted.

firebase-firestore/src/main/java/com/google/firebase/firestore/local/IndexedQueryEngine.java

Lines changed: 0 additions & 103 deletions
This file was deleted.

firebase-firestore/src/main/java/com/google/firebase/firestore/local/LocalStore.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ public LocalStore(
169169
new LocalDocumentsView(remoteDocuments, mutationQueue, documentOverlayCache, indexManager);
170170
this.queryEngine = queryEngine;
171171
this.indexBackfiller = indexBackfiller;
172-
queryEngine.setLocalDocumentsView(localDocuments);
173-
queryEngine.setIndexManager(indexManager);
172+
queryEngine.initialize(localDocuments, indexManager);
174173

175174
localViewReferences = new ReferenceSet();
176175
persistence.getReferenceDelegate().setInMemoryPins(localViewReferences);
@@ -215,8 +214,7 @@ public ImmutableSortedMap<DocumentKey, Document> handleUserChange(User user) {
215214
// Recreate our LocalDocumentsView using the new MutationQueue.
216215
localDocuments =
217216
new LocalDocumentsView(remoteDocuments, mutationQueue, documentOverlayCache, indexManager);
218-
queryEngine.setLocalDocumentsView(localDocuments);
219-
queryEngine.setIndexManager(indexManager);
217+
queryEngine.initialize(localDocuments, indexManager);
220218

221219
// TODO(indexing): Add spec tests that test these components change after a user change
222220
remoteDocuments.setIndexManager(indexManager);
@@ -854,8 +852,8 @@ public QueryResult executeQuery(Query query, boolean usePreviousResults) {
854852
ImmutableSortedMap<DocumentKey, Document> documents =
855853
queryEngine.getDocumentsMatchingQuery(
856854
query,
857-
usePreviousResults ? lastLimboFreeSnapshotVersion : SnapshotVersion.NONE,
858-
usePreviousResults ? remoteKeys : DocumentKey.emptyKeySet());
855+
remoteKeys,
856+
usePreviousResults ? lastLimboFreeSnapshotVersion : SnapshotVersion.NONE);
859857
return new QueryResult(documents, remoteKeys);
860858
}
861859

0 commit comments

Comments
 (0)