Skip to content

Commit af95074

Browse files
committed
remove unused code
1 parent d4272b3 commit af95074

File tree

7 files changed

+20
-177
lines changed

7 files changed

+20
-177
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
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;
5555
private final DocumentOverlayCache documentOverlayCache;
5656
private final IndexManager indexManager;
5757

58-
protected LocalDocumentsView(
58+
LocalDocumentsView(
5959
RemoteDocumentCache remoteDocumentCache,
6060
MutationQueue mutationQueue,
6161
DocumentOverlayCache documentOverlayCache,
@@ -279,7 +279,7 @@ ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
279279
* @param query The query to match documents against.
280280
* @param offset Read time and key to start scanning by (exclusive).
281281
*/
282-
protected ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
282+
ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
283283
Query query, IndexOffset offset) {
284284
return getDocumentsMatchingQuery(query, offset, /*context*/ null);
285285
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ private void setReferenceDelegate(ReferenceDelegate delegate) {
9494
}
9595

9696
@Override
97-
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
97+
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
9898
MemoryMutationQueue queue = mutationQueues.get(user);
9999
if (queue == null) {
100100
queue = new MemoryMutationQueue(this, user);
@@ -113,12 +113,12 @@ MemoryTargetCache getTargetCache() {
113113
}
114114

115115
@Override
116-
public MemoryRemoteDocumentCache getRemoteDocumentCache() {
116+
MemoryRemoteDocumentCache getRemoteDocumentCache() {
117117
return remoteDocumentCache;
118118
}
119119

120120
@Override
121-
public MemoryIndexManager getIndexManager(User user) {
121+
MemoryIndexManager getIndexManager(User user) {
122122
// We do not currently support indices for memory persistence, so we can return the same shared
123123
// instance of the memory index manager.
124124
return indexManager;
@@ -130,7 +130,7 @@ BundleCache getBundleCache() {
130130
}
131131

132132
@Override
133-
public DocumentOverlayCache getDocumentOverlayCache(User user) {
133+
DocumentOverlayCache getDocumentOverlayCache(User user) {
134134
MemoryDocumentOverlayCache overlay = overlays.get(user);
135135
if (overlay == null) {
136136
overlay = new MemoryDocumentOverlayCache();
@@ -145,7 +145,7 @@ OverlayMigrationManager getOverlayMigrationManager() {
145145
}
146146

147147
@Override
148-
public void runTransaction(String action, Runnable operation) {
148+
void runTransaction(String action, Runnable operation) {
149149
referenceDelegate.onTransactionStarted();
150150
try {
151151
operation.run();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import java.util.List;
2525

2626
/** A queue of mutations to apply to the remote store. */
27-
public interface MutationQueue {
27+
interface MutationQueue {
2828
/**
2929
* Starts the mutation queue, performing any initial reads that might be required to establish
3030
* invariants, etc.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ public abstract class Persistence {
7878
* implementation to the extent possible (e.g. in the case of uid switching from
7979
* sally=>jack=>sally, sally's mutation queue will be preserved).
8080
*/
81-
public abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);
81+
abstract MutationQueue getMutationQueue(User user, IndexManager indexManager);
8282

8383
/** Creates a TargetCache representing the persisted cache of queries. */
8484
abstract TargetCache getTargetCache();
8585

8686
/** Creates a RemoteDocumentCache representing the persisted cache of remote documents. */
87-
public abstract RemoteDocumentCache getRemoteDocumentCache();
87+
abstract RemoteDocumentCache getRemoteDocumentCache();
8888

8989
/** Creates an IndexManager that manages our persisted query indexes. */
90-
public abstract IndexManager getIndexManager(User user);
90+
abstract IndexManager getIndexManager(User user);
9191

9292
/** Returns a BundleCache representing the persisted cache of loaded bundles. */
9393
abstract BundleCache getBundleCache();
9494

9595
/** Returns a DocumentOverlayCache representing the documents that are mutated locally. */
96-
public abstract DocumentOverlayCache getDocumentOverlayCache(User user);
96+
abstract DocumentOverlayCache getDocumentOverlayCache(User user);
9797

9898
/** Returns a OverlayMigrationManager that runs any pending data migration required by SDK. */
9999
abstract OverlayMigrationManager getOverlayMigrationManager();
@@ -106,7 +106,7 @@ public abstract class Persistence {
106106
* @param action A description of the action performed by this transaction, used for logging.
107107
* @param operation The operation to run inside a transaction.
108108
*/
109-
public abstract void runTransaction(String action, Runnable operation);
109+
abstract void runTransaction(String action, Runnable operation);
110110

111111
/**
112112
* Performs an operation inside a persistence transaction. Any reads or writes against persistence

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* meaning we can cache both Document instances (an actual document with data) as well as NoDocument
3333
* instances (indicating that the document is known to not exist).
3434
*/
35-
public interface RemoteDocumentCache {
35+
interface RemoteDocumentCache {
3636

3737
/** Sets the index manager to use for managing the collectionGroup index. */
3838
void setIndexManager(IndexManager indexManager);

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public SQLiteLruReferenceDelegate getReferenceDelegate() {
171171
}
172172

173173
@Override
174-
public MutationQueue getMutationQueue(User user, IndexManager indexManager) {
174+
MutationQueue getMutationQueue(User user, IndexManager indexManager) {
175175
return new SQLiteMutationQueue(this, serializer, user, indexManager);
176176
}
177177

@@ -181,7 +181,7 @@ SQLiteTargetCache getTargetCache() {
181181
}
182182

183183
@Override
184-
public IndexManager getIndexManager(User user) {
184+
IndexManager getIndexManager(User user) {
185185
return new SQLiteIndexManager(this, serializer, user);
186186
}
187187

@@ -191,7 +191,7 @@ BundleCache getBundleCache() {
191191
}
192192

193193
@Override
194-
public DocumentOverlayCache getDocumentOverlayCache(User user) {
194+
DocumentOverlayCache getDocumentOverlayCache(User user) {
195195
return new SQLiteDocumentOverlayCache(this, this.serializer, user);
196196
}
197197

@@ -201,12 +201,12 @@ OverlayMigrationManager getOverlayMigrationManager() {
201201
}
202202

203203
@Override
204-
public RemoteDocumentCache getRemoteDocumentCache() {
204+
RemoteDocumentCache getRemoteDocumentCache() {
205205
return remoteDocumentCache;
206206
}
207207

208208
@Override
209-
public void runTransaction(String action, Runnable operation) {
209+
void runTransaction(String action, Runnable operation) {
210210
Logger.debug(TAG, "Starting transaction: %s", action);
211211
db.beginTransactionWithListener(transactionListener);
212212
try {

firebase-firestore/src/test/java/com/google/firebase/firestore/model/TargetIndexMatcherTest.java

Lines changed: 0 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -449,163 +449,6 @@ public void withMultipleNotIn() {
449449
validateServesTarget(q, "a", FieldIndex.Segment.Kind.ASCENDING);
450450
}
451451

452-
@Test
453-
public void buildTargetIndex() {
454-
Query q =
455-
query("collId")
456-
.filter(filter("a", "==", 1))
457-
.filter(filter("b", "==", 2))
458-
.orderBy(orderBy("__name__", "desc"));
459-
TargetIndexMatcher targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
460-
FieldIndex expectedIndex = targetIndexMatcher.BuildTargetIndex();
461-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
462-
463-
q = query("collId").orderBy(orderBy("a"));
464-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
465-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
466-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
467-
468-
q = query("collId").orderBy(orderBy("a")).orderBy(orderBy("b"));
469-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
470-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
471-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
472-
473-
q = query("collId").filter(filter("a", "array-contains", "a")).orderBy(orderBy("b"));
474-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
475-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
476-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
477-
478-
q = query("collId").orderBy(orderBy("b"));
479-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
480-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
481-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
482-
483-
q = query("collId").orderBy(orderBy("a"));
484-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
485-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
486-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
487-
488-
q = query("collId").filter(filter("a", ">", 1)).filter(filter("a", "<", 10));
489-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
490-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
491-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
492-
493-
q = query("collId").filter(filter("a", "in", Arrays.asList(1, 2))).filter(filter("b", "==", 5));
494-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
495-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
496-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
497-
498-
q = query("collId").filter(filter("value", "array-contains", "foo")).orderBy(orderBy("value"));
499-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
500-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
501-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
502-
503-
q =
504-
query("collId")
505-
.filter(filter("a", "array-contains", "a"))
506-
.filter(filter("a", ">", "b"))
507-
.orderBy(orderBy("a", "asc"));
508-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
509-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
510-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
511-
512-
q = query("collId").filter(filter("a", "==", 1)).orderBy(orderBy("__name__", "desc"));
513-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
514-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
515-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
516-
517-
q = query("collId").filter(filter("a1", "==", "a")).filter(filter("a2", "==", "b"));
518-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
519-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
520-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
521-
522-
q =
523-
query("collId")
524-
.filter(filter("equality1", "==", "a"))
525-
.filter(filter("equality2", "==", "b"))
526-
.filter(filter("inequality", ">=", "c"));
527-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
528-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
529-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
530-
531-
q =
532-
query("collId")
533-
.filter(filter("equality1", "==", "a"))
534-
.filter(filter("inequality", ">=", "c"))
535-
.filter(filter("equality2", "==", "b"));
536-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
537-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
538-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
539-
540-
q = query("collId").orderBy(orderBy("a"));
541-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
542-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
543-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
544-
545-
q = query("collId").orderBy(orderBy("a", "desc"));
546-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
547-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
548-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
549-
550-
q = query("collId").orderBy(orderBy("a")).orderBy(orderBy("__name__"));
551-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
552-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
553-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
554-
555-
q = query("collId").filter(filter("a", "!=", 1));
556-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
557-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
558-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
559-
560-
q = query("collId").filter(filter("a", "!=", 1)).orderBy(orderBy("a")).orderBy(orderBy("b"));
561-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
562-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
563-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
564-
565-
q = query("collId").filter(filter("a", "==", "a")).filter(filter("b", ">", "b"));
566-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
567-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
568-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
569-
570-
q =
571-
query("collId")
572-
.filter(filter("a1", "==", "a"))
573-
.filter(filter("a2", ">", "b"))
574-
.orderBy(orderBy("a2", "asc"));
575-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
576-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
577-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
578-
579-
q =
580-
query("collId")
581-
.filter(filter("a", ">=", 1))
582-
.filter(filter("a", "==", 5))
583-
.filter(filter("a", "<=", 10));
584-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
585-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
586-
// assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
587-
588-
q =
589-
query("collId")
590-
.filter(filter("a", "not-in", Arrays.asList(1, 2, 3)))
591-
.filter(filter("a", ">=", 2));
592-
targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
593-
expectedIndex = targetIndexMatcher.BuildTargetIndex();
594-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
595-
}
596-
597-
@Test
598-
public void failedTest() {
599-
Query q =
600-
query("collId")
601-
.filter(filter("a", ">=", 1))
602-
.filter(filter("a", "==", 5))
603-
.filter(filter("a", "<=", 10));
604-
TargetIndexMatcher targetIndexMatcher = new TargetIndexMatcher(q.toTarget());
605-
FieldIndex expectedIndex = targetIndexMatcher.BuildTargetIndex();
606-
assertTrue(targetIndexMatcher.servedByIndex(expectedIndex));
607-
}
608-
609452
@Test
610453
public void withMultipleOrderBys() {
611454
Query q =

0 commit comments

Comments
 (0)