Skip to content

Renaming from webclient review #31

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 1 commit into from
Sep 19, 2018
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 @@ -146,7 +146,7 @@ public LocalStore(Persistence persistence, User initialUser) {
queryEngine = new SimpleQueryEngine(localDocuments);

localViewReferences = new ReferenceSet();
persistence.getReferenceDelegate().setAdditionalReferences(localViewReferences);
persistence.getReferenceDelegate().setInMemoryPins(localViewReferences);

targetIds = new SparseArray<>();
heldBatchResults = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

/** Provides eager garbage collection for MemoryPersistence. */
class MemoryEagerReferenceDelegate implements ReferenceDelegate {
private ReferenceSet additionalReferences;
private ReferenceSet inMemoryPins;
private final MemoryPersistence persistence;
private Set<DocumentKey> orphanedDocuments;

Expand All @@ -35,8 +35,8 @@ public long getCurrentSequenceNumber() {
}

@Override
public void setAdditionalReferences(ReferenceSet additionalReferences) {
this.additionalReferences = additionalReferences;
public void setInMemoryPins(ReferenceSet inMemoryPins) {
this.inMemoryPins = inMemoryPins;
}

@Override
Expand Down Expand Up @@ -108,7 +108,7 @@ private boolean isReferenced(DocumentKey key) {
return true;
}

if (additionalReferences != null && additionalReferences.containsKey(key)) {
if (inMemoryPins != null && inMemoryPins.containsKey(key)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class MemoryLruReferenceDelegate implements ReferenceDelegate, LruDelegate {
private final MemoryPersistence persistence;
private final Map<DocumentKey, Long> orphanedSequenceNumbers;
private ReferenceSet additionalReferences;
private ReferenceSet inMemoryPins;
private final LruGarbageCollector garbageCollector;
private final ListenSequence listenSequence;
private long currentSequenceNumber;
Expand Down Expand Up @@ -88,8 +88,8 @@ public void forEachOrphanedDocumentSequenceNumber(Consumer<Long> consumer) {
}

@Override
public void setAdditionalReferences(ReferenceSet additionalReferences) {
this.additionalReferences = additionalReferences;
public void setInMemoryPins(ReferenceSet inMemoryPins) {
this.inMemoryPins = inMemoryPins;
}

@Override
Expand Down Expand Up @@ -144,7 +144,7 @@ public boolean isPinned(DocumentKey key, long upperBound) {
return true;
}

if (additionalReferences.containsKey(key)) {
if (inMemoryPins.containsKey(key)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface ReferenceDelegate {
* Registers a ReferenceSet of documents that should be considered 'referenced' and not eligible
* for removal during garbage collection.
*/
void setAdditionalReferences(ReferenceSet additionalReferences);
void setInMemoryPins(ReferenceSet inMemoryPins);

/** Notify the delegate that the given document was added to a target. */
void addReference(DocumentKey key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SQLiteLruReferenceDelegate implements ReferenceDelegate, LruDelegate {
private ListenSequence listenSequence;
private long currentSequenceNumber;
private final LruGarbageCollector garbageCollector;
private ReferenceSet additionalReferences;
private ReferenceSet inMemoryPins;

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

@Override
public void setAdditionalReferences(ReferenceSet additionalReferences) {
this.additionalReferences = additionalReferences;
public void setInMemoryPins(ReferenceSet inMemoryPins) {
this.inMemoryPins = inMemoryPins;
}

@Override
Expand Down Expand Up @@ -126,7 +126,7 @@ private boolean mutationQueuesContainKey(DocumentKey key) {
* equal to the upper bound for the collection run.
*/
private boolean isPinned(DocumentKey key) {
if (additionalReferences.containsKey(key)) {
if (inMemoryPins.containsKey(key)) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void tearDown() {

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

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