Skip to content

Merge the Index Engines #3208

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 5 commits into from
Dec 9, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
import com.google.firebase.database.collection.ImmutableSortedSet;
import com.google.firebase.firestore.auth.User;
import com.google.firebase.firestore.core.OnlineState;
import com.google.firebase.firestore.local.DefaultQueryEngine;
import com.google.firebase.firestore.local.IndexBackfiller;
import com.google.firebase.firestore.local.LocalStore;
import com.google.firebase.firestore.local.MemoryPersistence;
import com.google.firebase.firestore.local.Persistence;
import com.google.firebase.firestore.local.QueryEngine;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.mutation.MutationBatchResult;
import com.google.firebase.firestore.testutil.IntegrationTestUtil;
Expand Down Expand Up @@ -76,7 +76,7 @@ public ImmutableSortedSet<DocumentKey> getRemoteKeysForTarget(int targetId) {
};

FakeConnectivityMonitor connectivityMonitor = new FakeConnectivityMonitor();
DefaultQueryEngine queryEngine = new DefaultQueryEngine();
QueryEngine queryEngine = new QueryEngine();
Persistence persistence = MemoryPersistence.createEagerGcMemoryPersistence();
persistence.start();
IndexBackfiller indexBackfiller = new IndexBackfiller(persistence, new AsyncQueue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import androidx.annotation.Nullable;
import com.google.firebase.database.collection.ImmutableSortedSet;
import com.google.firebase.firestore.local.DefaultQueryEngine;
import com.google.firebase.firestore.local.IndexBackfiller;
import com.google.firebase.firestore.local.LocalStore;
import com.google.firebase.firestore.local.MemoryPersistence;
import com.google.firebase.firestore.local.Persistence;
import com.google.firebase.firestore.local.QueryEngine;
import com.google.firebase.firestore.local.Scheduler;
import com.google.firebase.firestore.model.DocumentKey;
import com.google.firebase.firestore.model.mutation.MutationBatchResult;
Expand Down Expand Up @@ -54,10 +54,7 @@ protected EventManager createEventManager(Configuration configuration) {
@Override
protected LocalStore createLocalStore(Configuration configuration) {
return new LocalStore(
getPersistence(),
getIndexBackfiller(),
new DefaultQueryEngine(),
configuration.getInitialUser());
getPersistence(), getIndexBackfiller(), new QueryEngine(), configuration.getInitialUser());
}

@Override
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@ public LocalStore(
new LocalDocumentsView(remoteDocuments, mutationQueue, documentOverlayCache, indexManager);
this.queryEngine = queryEngine;
this.indexBackfiller = indexBackfiller;
queryEngine.setLocalDocumentsView(localDocuments);
queryEngine.setIndexManager(indexManager);
queryEngine.initialize(localDocuments, indexManager);

localViewReferences = new ReferenceSet();
persistence.getReferenceDelegate().setInMemoryPins(localViewReferences);
Expand Down Expand Up @@ -215,8 +214,7 @@ public ImmutableSortedMap<DocumentKey, Document> handleUserChange(User user) {
// Recreate our LocalDocumentsView using the new MutationQueue.
localDocuments =
new LocalDocumentsView(remoteDocuments, mutationQueue, documentOverlayCache, indexManager);
queryEngine.setLocalDocumentsView(localDocuments);
queryEngine.setIndexManager(indexManager);
queryEngine.initialize(localDocuments, indexManager);

// TODO(indexing): Add spec tests that test these components change after a user change
remoteDocuments.setIndexManager(indexManager);
Expand Down Expand Up @@ -849,7 +847,7 @@ public QueryResult executeQuery(Query query, boolean usePreviousResults) {
queryEngine.getDocumentsMatchingQuery(
query,
usePreviousResults ? lastLimboFreeSnapshotVersion : SnapshotVersion.NONE,
usePreviousResults ? remoteKeys : DocumentKey.emptyKeySet());
remoteKeys);
return new QueryResult(documents, remoteKeys);
}

Expand Down
Loading