Skip to content

Commit 549c9bf

Browse files
Simplify
1 parent bdeff87 commit 549c9bf

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ImmutableSortedMap<DocumentKey, Document> getDocuments(Iterable<DocumentKey> key
123123
* @param existenceStateChanged The set of document keys whose existence state is changed. This is
124124
* useful to determine if some documents overlay needs to be recalculated.
125125
*/
126-
ImmutableSortedMap<DocumentKey, Document> getLocalViewOfDocuments(
126+
private ImmutableSortedMap<DocumentKey, Document> getLocalViewOfDocuments(
127127
Map<DocumentKey, MutableDocument> docs,
128128
Function<DocumentKey, Overlay> overlays,
129129
Set<DocumentKey> existenceStateChanged) {
@@ -153,6 +153,20 @@ ImmutableSortedMap<DocumentKey, Document> getLocalViewOfDocuments(
153153
return results;
154154
}
155155

156+
/**
157+
* Similar to {@link #getDocuments}, but creates the local view from the given {@code baseDocs}
158+
* without retrieving documents from the local store.
159+
*
160+
* @param docs The documents to apply local mutations to get the local views.
161+
* @param existenceStateChanged The set of document keys whose existence state is changed. This is
162+
* useful to determine if some documents overlay needs to be recalculated.
163+
*/
164+
ImmutableSortedMap<DocumentKey, Document> getLocalViewOfDocuments(
165+
Map<DocumentKey, MutableDocument> docs,
166+
Set<DocumentKey> existenceStateChanged) {
167+
return getLocalViewOfDocuments(docs, documentOverlayCache::getOverlay, existenceStateChanged);
168+
}
169+
156170
private void recalculateAndSaveOverlays(Map<DocumentKey, MutableDocument> docs) {
157171
List<MutationBatch> batches =
158172
mutationQueue.getAllMutationBatchesAffectingDocumentKeys(docs.keySet());

0 commit comments

Comments
 (0)