Skip to content

Commit 351df0e

Browse files
author
Greg Soltis
authored
Renaming from webclient review (#31)
`additionalReferences` -> `inMemoryPins`
1 parent 7005c97 commit 351df0e

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public LocalStore(Persistence persistence, User initialUser) {
146146
queryEngine = new SimpleQueryEngine(localDocuments);
147147

148148
localViewReferences = new ReferenceSet();
149-
persistence.getReferenceDelegate().setAdditionalReferences(localViewReferences);
149+
persistence.getReferenceDelegate().setInMemoryPins(localViewReferences);
150150

151151
targetIds = new SparseArray<>();
152152
heldBatchResults = new ArrayList<>();

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/** Provides eager garbage collection for MemoryPersistence. */
2323
class MemoryEagerReferenceDelegate implements ReferenceDelegate {
24-
private ReferenceSet additionalReferences;
24+
private ReferenceSet inMemoryPins;
2525
private final MemoryPersistence persistence;
2626
private Set<DocumentKey> orphanedDocuments;
2727

@@ -35,8 +35,8 @@ public long getCurrentSequenceNumber() {
3535
}
3636

3737
@Override
38-
public void setAdditionalReferences(ReferenceSet additionalReferences) {
39-
this.additionalReferences = additionalReferences;
38+
public void setInMemoryPins(ReferenceSet inMemoryPins) {
39+
this.inMemoryPins = inMemoryPins;
4040
}
4141

4242
@Override
@@ -108,7 +108,7 @@ private boolean isReferenced(DocumentKey key) {
108108
return true;
109109
}
110110

111-
if (additionalReferences != null && additionalReferences.containsKey(key)) {
111+
if (inMemoryPins != null && inMemoryPins.containsKey(key)) {
112112
return true;
113113
}
114114

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
class MemoryLruReferenceDelegate implements ReferenceDelegate, LruDelegate {
2828
private final MemoryPersistence persistence;
2929
private final Map<DocumentKey, Long> orphanedSequenceNumbers;
30-
private ReferenceSet additionalReferences;
30+
private ReferenceSet inMemoryPins;
3131
private final LruGarbageCollector garbageCollector;
3232
private final ListenSequence listenSequence;
3333
private long currentSequenceNumber;
@@ -88,8 +88,8 @@ public void forEachOrphanedDocumentSequenceNumber(Consumer<Long> consumer) {
8888
}
8989

9090
@Override
91-
public void setAdditionalReferences(ReferenceSet additionalReferences) {
92-
this.additionalReferences = additionalReferences;
91+
public void setInMemoryPins(ReferenceSet inMemoryPins) {
92+
this.inMemoryPins = inMemoryPins;
9393
}
9494

9595
@Override
@@ -144,7 +144,7 @@ public boolean isPinned(DocumentKey key, long upperBound) {
144144
return true;
145145
}
146146

147-
if (additionalReferences.containsKey(key)) {
147+
if (inMemoryPins.containsKey(key)) {
148148
return true;
149149
}
150150

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ interface ReferenceDelegate {
3232
* Registers a ReferenceSet of documents that should be considered 'referenced' and not eligible
3333
* for removal during garbage collection.
3434
*/
35-
void setAdditionalReferences(ReferenceSet additionalReferences);
35+
void setInMemoryPins(ReferenceSet inMemoryPins);
3636

3737
/** Notify the delegate that the given document was added to a target. */
3838
void addReference(DocumentKey key);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SQLiteLruReferenceDelegate implements ReferenceDelegate, LruDelegate {
2828
private ListenSequence listenSequence;
2929
private long currentSequenceNumber;
3030
private final LruGarbageCollector garbageCollector;
31-
private ReferenceSet additionalReferences;
31+
private ReferenceSet inMemoryPins;
3232

3333
SQLiteLruReferenceDelegate(SQLitePersistence persistence) {
3434
this.currentSequenceNumber = ListenSequence.INVALID;
@@ -88,8 +88,8 @@ public void forEachOrphanedDocumentSequenceNumber(Consumer<Long> consumer) {
8888
}
8989

9090
@Override
91-
public void setAdditionalReferences(ReferenceSet additionalReferences) {
92-
this.additionalReferences = additionalReferences;
91+
public void setInMemoryPins(ReferenceSet inMemoryPins) {
92+
this.inMemoryPins = inMemoryPins;
9393
}
9494

9595
@Override
@@ -126,7 +126,7 @@ private boolean mutationQueuesContainKey(DocumentKey key) {
126126
* equal to the upper bound for the collection run.
127127
*/
128128
private boolean isPinned(DocumentKey key) {
129-
if (additionalReferences.containsKey(key)) {
129+
if (inMemoryPins.containsKey(key)) {
130130
return true;
131131
}
132132

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void tearDown() {
8181

8282
private void newTestResources() {
8383
persistence = createPersistence();
84-
persistence.getReferenceDelegate().setAdditionalReferences(new ReferenceSet());
84+
persistence.getReferenceDelegate().setInMemoryPins(new ReferenceSet());
8585
queryCache = persistence.getQueryCache();
8686
documentCache = persistence.getRemoteDocumentCache();
8787
User user = new User("user");
@@ -410,7 +410,7 @@ public void testRemoveTargetsThenGC() {
410410
// All docs in oldest target are still around
411411
// One blind write is gone, the first one not added to oldest target
412412
// Documents removed from middle target are gone, except ones added to oldest target
413-
// Documents from newest target are gone, except
413+
// Documents from newest target are gone, except those added to the old target as well
414414

415415
// Through the various steps, track which documents we expect to be removed vs
416416
// documents we expect to be retained.

0 commit comments

Comments
 (0)