Skip to content

Commit 400e1b3

Browse files
committed
Slight refactor
1 parent 93e8be1 commit 400e1b3

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import com.google.firebase.firestore.local.IndexBackfiller;
1818
import com.google.firebase.firestore.local.LocalSerializer;
19-
import com.google.firebase.firestore.local.LocalStore;
2019
import com.google.firebase.firestore.local.LruDelegate;
2120
import com.google.firebase.firestore.local.LruGarbageCollector;
2221
import com.google.firebase.firestore.local.Persistence;
@@ -36,12 +35,7 @@ protected Scheduler createGarbageCollectionScheduler(Configuration configuration
3635

3736
@Override
3837
protected IndexBackfiller createIndexBackfiller(Configuration configuration) {
39-
LocalStore localStore = getLocalStore();
40-
return new IndexBackfiller(
41-
getPersistence(),
42-
configuration.getAsyncQueue(),
43-
localStore::getIndexManagerForCurrentUser,
44-
localStore::getLocalDocumentsForCurrentUser);
38+
return new IndexBackfiller(getPersistence(), configuration.getAsyncQueue(), getLocalStore());
4539
}
4640

4741
@Override

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ public class IndexBackfiller {
4444
private final Supplier<LocalDocumentsView> localDocumentsViewOfCurrentUser;
4545
private int maxDocumentsToProcess = MAX_DOCUMENTS_TO_PROCESS;
4646

47+
public IndexBackfiller(Persistence persistence, AsyncQueue asyncQueue, LocalStore localStore) {
48+
this(
49+
persistence,
50+
asyncQueue,
51+
localStore::getIndexManagerForCurrentUser,
52+
localStore::getLocalDocumentsForCurrentUser);
53+
}
54+
4755
public IndexBackfiller(
4856
Persistence persistence,
4957
AsyncQueue asyncQueue,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* in remoteDocumentCache or local mutations for the document). The view is computed by applying the
4949
* mutations in the MutationQueue to the RemoteDocumentCache.
5050
*/
51-
public class LocalDocumentsView {
51+
class LocalDocumentsView {
5252

5353
private final RemoteDocumentCache remoteDocumentCache;
5454
private final MutationQueue mutationQueue;

firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,7 @@ public void setUp() {
126126
queryEngine = new CountingQueryEngine(new QueryEngine());
127127
localStore = new LocalStore(localStorePersistence, queryEngine, User.UNAUTHENTICATED);
128128
localStore.start();
129-
indexBackfiller =
130-
new IndexBackfiller(
131-
localStorePersistence,
132-
new AsyncQueue(),
133-
localStore::getIndexManagerForCurrentUser,
134-
localStore::getLocalDocumentsForCurrentUser);
129+
indexBackfiller = new IndexBackfiller(localStorePersistence, new AsyncQueue(), localStore);
135130
}
136131

137132
@After

0 commit comments

Comments
 (0)