From 5fd82c13fa2d1c50b6a4eea4a1ed535f01eafeca Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Thu, 2 Nov 2023 15:53:22 -0400 Subject: [PATCH 1/8] port code from web --- .../Tests/SpecTests/json/limbo_spec_test.json | 33 ++++++++++--------- .../Tests/SpecTests/json/limit_spec_test.json | 8 +++++ Firestore/core/src/core/sync_engine.cc | 12 +++++-- Firestore/core/src/core/view.cc | 15 +++++++-- Firestore/core/src/core/view.h | 16 +++++++++ 5 files changed, 64 insertions(+), 20 deletions(-) diff --git a/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json b/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json index adffb61f510..7bb1c4279e4 100644 --- a/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json +++ b/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json @@ -8221,6 +8221,14 @@ ] } }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-1001" + ] + }, { "watchSnapshot": { "targetIds": [ @@ -8278,22 +8286,7 @@ "path": "collection" } } - ] - }, - { - "watchCurrent": [ - [ - 2 - ], - "resume-token-1002" - ] - }, - { - "watchSnapshot": { - "targetIds": [ - ], - "version": 1002 - }, + ], "expectedState": { "activeLimboDocs": [ "collection/a1", @@ -8608,6 +8601,14 @@ ] } }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-1001" + ] + }, { "watchSnapshot": { "targetIds": [ diff --git a/Firestore/Example/Tests/SpecTests/json/limit_spec_test.json b/Firestore/Example/Tests/SpecTests/json/limit_spec_test.json index fe1ed3c7c73..86ae7f214c9 100644 --- a/Firestore/Example/Tests/SpecTests/json/limit_spec_test.json +++ b/Firestore/Example/Tests/SpecTests/json/limit_spec_test.json @@ -5620,6 +5620,14 @@ ] } }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-1004" + ] + }, { "watchSnapshot": { "targetIds": [ diff --git a/Firestore/core/src/core/sync_engine.cc b/Firestore/core/src/core/sync_engine.cc index 3a68dff69f8..420536ffe96 100644 --- a/Firestore/core/src/core/sync_engine.cc +++ b/Firestore/core/src/core/sync_engine.cc @@ -495,15 +495,23 @@ void SyncEngine::EmitNewSnapshotsAndNotifyLocalStore( } absl::optional target_changes; + bool waitForRequeryResult = false; if (maybe_remote_event.has_value()) { const RemoteEvent& remote_event = maybe_remote_event.value(); auto it = remote_event.target_changes().find(query_view->target_id()); if (it != remote_event.target_changes().end()) { target_changes = it->second; } + + auto found = + remote_event.target_mismatches().find(query_view->target_id()); + if (found != remote_event.target_mismatches().end()) { + waitForRequeryResult = true; + } } - ViewChange view_change = - view.ApplyChanges(view_doc_changes, target_changes); + + ViewChange view_change = view.ApplyChanges(view_doc_changes, target_changes, + waitForRequeryResult); UpdateTrackedLimboDocuments(view_change.limbo_changes(), query_view->target_id()); diff --git a/Firestore/core/src/core/view.cc b/Firestore/core/src/core/view.cc index af31b0ee696..7dd4986f850 100644 --- a/Firestore/core/src/core/view.cc +++ b/Firestore/core/src/core/view.cc @@ -253,6 +253,12 @@ ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes) { ViewChange View::ApplyChanges( const ViewDocumentChanges& doc_changes, const absl::optional& target_change) { + return ApplyChanges(doc_changes, target_change, false); +} + +ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, + const absl::optional& target_change, + bool waitForRequeryResult) { HARD_ASSERT(!doc_changes.needs_refill(), "Cannot apply changes that need a refill"); @@ -275,8 +281,13 @@ ViewChange View::ApplyChanges( }); ApplyTargetChange(target_change); - std::vector limbo_changes = UpdateLimboDocuments(); - bool synced = limbo_documents_.empty() && current_; + std::vector limbo_changes = {}; + if(!waitForRequeryResult) limbo_changes = UpdateLimboDocuments(); + + // We are at synced state if there is no limbo docs are waiting to be resolved, view is current + // with the backend, and the query is not pending for full re-query result due to existence + // filter mismatch. + bool synced = limbo_documents_.empty() && current_ && !waitForRequeryResult; SyncState new_sync_state = synced ? SyncState::Synced : SyncState::Local; bool sync_state_changed = new_sync_state != sync_state_; sync_state_ = new_sync_state; diff --git a/Firestore/core/src/core/view.h b/Firestore/core/src/core/view.h index b3cdbce69fc..af376b60eb6 100644 --- a/Firestore/core/src/core/view.h +++ b/Firestore/core/src/core/view.h @@ -182,6 +182,22 @@ class View { const core::ViewDocumentChanges& doc_changes, const absl::optional& target_change); + /** + * Updates the view with the given ViewDocumentChanges and updates limbo docs + * and sync state from the given (optional) target change. + * + * @param doc_changes The set of changes to make to the view's docs. + * @param target_change A target change to apply for computing limbo docs and + * sync state. + * @param waitForRequeryResult - Whether the target is pending to run a full + * re-query due to existence filter mismatch. + * @return A new ViewChange with the given docs, changes, and sync state. + */ + ViewChange ApplyChanges( + const core::ViewDocumentChanges& doc_changes, + const absl::optional& target_change, + bool waitForRequeryResult); + /** * Applies an OnlineState change to the view, potentially generating an * ViewChange if the view's sync_state_ changes as a result. From e0788bd8bb2b5d4b790218442edbfe9c29196ad1 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:04:05 -0400 Subject: [PATCH 2/8] format --- Firestore/core/src/core/view.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Firestore/core/src/core/view.cc b/Firestore/core/src/core/view.cc index 7dd4986f850..b13603bb757 100644 --- a/Firestore/core/src/core/view.cc +++ b/Firestore/core/src/core/view.cc @@ -282,11 +282,11 @@ ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, ApplyTargetChange(target_change); std::vector limbo_changes = {}; - if(!waitForRequeryResult) limbo_changes = UpdateLimboDocuments(); + if (!waitForRequeryResult) limbo_changes = UpdateLimboDocuments(); - // We are at synced state if there is no limbo docs are waiting to be resolved, view is current - // with the backend, and the query is not pending for full re-query result due to existence - // filter mismatch. + // We are at synced state if there is no limbo docs are waiting to be + // resolved, view is current with the backend, and the query is not pending + // for full re-query result due to existence filter mismatch. bool synced = limbo_documents_.empty() && current_ && !waitForRequeryResult; SyncState new_sync_state = synced ? SyncState::Synced : SyncState::Local; bool sync_state_changed = new_sync_state != sync_state_; From 9e89fa91acc3a8c6c45a00a50d2254e4d3f66357 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Fri, 3 Nov 2023 11:41:45 -0400 Subject: [PATCH 3/8] format --- Firestore/core/src/core/sync_engine.cc | 6 +++--- Firestore/core/src/core/view.cc | 9 +++++---- Firestore/core/src/core/view.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Firestore/core/src/core/sync_engine.cc b/Firestore/core/src/core/sync_engine.cc index 420536ffe96..921ee753539 100644 --- a/Firestore/core/src/core/sync_engine.cc +++ b/Firestore/core/src/core/sync_engine.cc @@ -503,9 +503,9 @@ void SyncEngine::EmitNewSnapshotsAndNotifyLocalStore( target_changes = it->second; } - auto found = - remote_event.target_mismatches().find(query_view->target_id()); - if (found != remote_event.target_mismatches().end()) { + const auto& target_mismatches = remote_event.target_mismatches(); + if (target_mismatches.find(query_view->target_id()) != + target_mismatches.end()) { waitForRequeryResult = true; } } diff --git a/Firestore/core/src/core/view.cc b/Firestore/core/src/core/view.cc index b13603bb757..732d4849973 100644 --- a/Firestore/core/src/core/view.cc +++ b/Firestore/core/src/core/view.cc @@ -281,8 +281,8 @@ ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, }); ApplyTargetChange(target_change); - std::vector limbo_changes = {}; - if (!waitForRequeryResult) limbo_changes = UpdateLimboDocuments(); + std::vector limbo_changes = + UpdateLimboDocuments(waitForRequeryResult); // We are at synced state if there is no limbo docs are waiting to be // resolved, view is current with the backend, and the query is not pending @@ -375,9 +375,10 @@ void View::ApplyTargetChange( } /** Updates limbo_documents_ and returns any changes as LimboDocumentChanges. */ -std::vector View::UpdateLimboDocuments() { +std::vector View::UpdateLimboDocuments( + bool waitForRequeryResult) { // We can only determine limbo documents when we're in-sync with the server. - if (!current_) { + if (waitForRequeryResult || !current_) { return {}; } diff --git a/Firestore/core/src/core/view.h b/Firestore/core/src/core/view.h index af376b60eb6..32ffb9ca3c5 100644 --- a/Firestore/core/src/core/view.h +++ b/Firestore/core/src/core/view.h @@ -220,7 +220,8 @@ class View { void ApplyTargetChange( const absl::optional& maybe_target_change); - std::vector UpdateLimboDocuments(); + std::vector UpdateLimboDocuments( + bool waitForRequeryResult); Query query_; From 7337359084cbb891f0b460765cffd9ee1cf8eafc Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Fri, 3 Nov 2023 13:57:03 -0400 Subject: [PATCH 4/8] Update sync_engine.cc --- Firestore/core/src/core/sync_engine.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Firestore/core/src/core/sync_engine.cc b/Firestore/core/src/core/sync_engine.cc index 921ee753539..036e8542839 100644 --- a/Firestore/core/src/core/sync_engine.cc +++ b/Firestore/core/src/core/sync_engine.cc @@ -498,14 +498,15 @@ void SyncEngine::EmitNewSnapshotsAndNotifyLocalStore( bool waitForRequeryResult = false; if (maybe_remote_event.has_value()) { const RemoteEvent& remote_event = maybe_remote_event.value(); - auto it = remote_event.target_changes().find(query_view->target_id()); - if (it != remote_event.target_changes().end()) { - target_changes = it->second; + auto changes_iter = + remote_event.target_changes().find(query_view->target_id()); + if (changes_iter != remote_event.target_changes().end()) { + target_changes = changes_iter->second; } - const auto& target_mismatches = remote_event.target_mismatches(); - if (target_mismatches.find(query_view->target_id()) != - target_mismatches.end()) { + auto mismatches_iter = + remote_event.target_mismatches().find(query_view->target_id()); + if (mismatches_iter != remote_event.target_mismatches().end()) { waitForRequeryResult = true; } } From 9bc662583c3bbaff6120f9c2395840fc7808e915 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 6 Nov 2023 17:20:40 -0500 Subject: [PATCH 5/8] Update limbo_spec_test.json --- .../Tests/SpecTests/json/limbo_spec_test.json | 372 ++++++++++++++++++ 1 file changed, 372 insertions(+) diff --git a/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json b/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json index 7bb1c4279e4..6cb27ecc40d 100644 --- a/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json +++ b/Firestore/Example/Tests/SpecTests/json/limbo_spec_test.json @@ -7013,6 +7013,378 @@ } ] }, + "Limbo resolution should wait for full re-query result if there is an existence filter mismatch ": { + "describeName": "Limbo Documents:", + "itName": "Limbo resolution should wait for full re-query result if there is an existence filter mismatch ", + "tags": [ + ], + "config": { + "numClients": 1, + "useEagerGCForMemory": true + }, + "steps": [ + { + "userListen": { + "query": { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + }, + "targetId": 2 + }, + "expectedState": { + "activeTargets": { + "2": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + ], + "resumeToken": "" + } + } + } + }, + { + "watchAck": [ + 2 + ] + }, + { + "watchEntity": { + "docs": [ + { + "createTime": 0, + "key": "collection/a", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 1 + }, + "version": 1000 + }, + { + "createTime": 0, + "key": "collection/b", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 2 + }, + "version": 1000 + } + ], + "targets": [ + 2 + ] + } + }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-1000" + ] + }, + { + "watchSnapshot": { + "targetIds": [ + ], + "version": 1000 + }, + "expectedSnapshotEvents": [ + { + "added": [ + { + "createTime": 0, + "key": "collection/a", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 1 + }, + "version": 1000 + }, + { + "createTime": 0, + "key": "collection/b", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 2 + }, + "version": 1000 + } + ], + "errorCode": 0, + "fromCache": false, + "hasPendingWrites": false, + "query": { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + } + ] + }, + { + "enableNetwork": false, + "expectedSnapshotEvents": [ + { + "errorCode": 0, + "fromCache": true, + "hasPendingWrites": false, + "query": { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + } + ], + "expectedState": { + "activeLimboDocs": [ + ], + "activeTargets": { + }, + "enqueuedLimboDocs": [ + ] + } + }, + { + "enableNetwork": true, + "expectedState": { + "activeTargets": { + "2": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + ], + "resumeToken": "resume-token-1000" + } + } + } + }, + { + "watchAck": [ + 2 + ] + }, + { + "watchFilter": { + "keys": [ + "collection/a" + ], + "targetIds": [ + 2 + ] + } + }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-2000" + ] + }, + { + "watchSnapshot": { + "targetIds": [ + ], + "version": 2000 + }, + "expectedState": { + "activeTargets": { + "2": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + ], + "resumeToken": "", + "targetPurpose": "TargetPurposeExistenceFilterMismatch" + } + } + } + }, + { + "watchRemove": { + "targetIds": [ + 2 + ] + } + }, + { + "watchAck": [ + 2 + ] + }, + { + "watchEntity": { + "docs": [ + { + "createTime": 0, + "key": "collection/a", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 1 + }, + "version": 1000 + } + ], + "targets": [ + 2 + ] + } + }, + { + "watchCurrent": [ + [ + 2 + ], + "resume-token-3000" + ] + }, + { + "watchSnapshot": { + "targetIds": [ + ], + "version": 3000 + }, + "expectedState": { + "activeLimboDocs": [ + "collection/b" + ], + "activeTargets": { + "1": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection/b" + } + ], + "resumeToken": "", + "targetPurpose": "TargetPurposeLimboResolution" + }, + "2": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + ], + "resumeToken": "", + "targetPurpose": "TargetPurposeExistenceFilterMismatch" + } + } + } + }, + { + "watchAck": [ + 1 + ] + }, + { + "watchCurrent": [ + [ + 1 + ], + "resume-token-3000" + ] + }, + { + "watchSnapshot": { + "targetIds": [ + ], + "version": 3000 + }, + "expectedSnapshotEvents": [ + { + "errorCode": 0, + "fromCache": false, + "hasPendingWrites": false, + "query": { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + }, + "removed": [ + { + "createTime": 0, + "key": "collection/b", + "options": { + "hasCommittedMutations": false, + "hasLocalMutations": false + }, + "value": { + "v": 2 + }, + "version": 1000 + } + ] + } + ], + "expectedState": { + "activeLimboDocs": [ + ], + "activeTargets": { + "2": { + "queries": [ + { + "filters": [ + ], + "orderBys": [ + ], + "path": "collection" + } + ], + "resumeToken": "", + "targetPurpose": "TargetPurposeExistenceFilterMismatch" + } + } + } + } + ] + }, "Limbo resolution throttling when a limbo listen is rejected.": { "describeName": "Limbo Documents:", "itName": "Limbo resolution throttling when a limbo listen is rejected.", From 5424917d5ac9f5331672048a731455f391758a06 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:23:02 -0500 Subject: [PATCH 6/8] port changes in web PR --- Firestore/core/src/core/sync_engine.cc | 6 +++--- Firestore/core/src/core/view.cc | 14 +++++++------- Firestore/core/src/core/view.h | 10 +++++----- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Firestore/core/src/core/sync_engine.cc b/Firestore/core/src/core/sync_engine.cc index 036e8542839..24a4c3f7803 100644 --- a/Firestore/core/src/core/sync_engine.cc +++ b/Firestore/core/src/core/sync_engine.cc @@ -495,7 +495,7 @@ void SyncEngine::EmitNewSnapshotsAndNotifyLocalStore( } absl::optional target_changes; - bool waitForRequeryResult = false; + bool targetIsPendingReset = false; if (maybe_remote_event.has_value()) { const RemoteEvent& remote_event = maybe_remote_event.value(); auto changes_iter = @@ -507,12 +507,12 @@ void SyncEngine::EmitNewSnapshotsAndNotifyLocalStore( auto mismatches_iter = remote_event.target_mismatches().find(query_view->target_id()); if (mismatches_iter != remote_event.target_mismatches().end()) { - waitForRequeryResult = true; + targetIsPendingReset = true; } } ViewChange view_change = view.ApplyChanges(view_doc_changes, target_changes, - waitForRequeryResult); + targetIsPendingReset); UpdateTrackedLimboDocuments(view_change.limbo_changes(), query_view->target_id()); diff --git a/Firestore/core/src/core/view.cc b/Firestore/core/src/core/view.cc index 732d4849973..5911d962381 100644 --- a/Firestore/core/src/core/view.cc +++ b/Firestore/core/src/core/view.cc @@ -258,7 +258,7 @@ ViewChange View::ApplyChanges( ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, const absl::optional& target_change, - bool waitForRequeryResult) { + bool targetIsPendingReset) { HARD_ASSERT(!doc_changes.needs_refill(), "Cannot apply changes that need a refill"); @@ -282,12 +282,13 @@ ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, ApplyTargetChange(target_change); std::vector limbo_changes = - UpdateLimboDocuments(waitForRequeryResult); + targetIsPendingReset ? std::vector{} + : UpdateLimboDocuments(); // We are at synced state if there is no limbo docs are waiting to be // resolved, view is current with the backend, and the query is not pending - // for full re-query result due to existence filter mismatch. - bool synced = limbo_documents_.empty() && current_ && !waitForRequeryResult; + // to reset due to existence filter mismatch. + bool synced = limbo_documents_.empty() && current_ && !targetIsPendingReset; SyncState new_sync_state = synced ? SyncState::Synced : SyncState::Local; bool sync_state_changed = new_sync_state != sync_state_; sync_state_ = new_sync_state; @@ -375,10 +376,9 @@ void View::ApplyTargetChange( } /** Updates limbo_documents_ and returns any changes as LimboDocumentChanges. */ -std::vector View::UpdateLimboDocuments( - bool waitForRequeryResult) { +std::vector View::UpdateLimboDocuments() { // We can only determine limbo documents when we're in-sync with the server. - if (waitForRequeryResult || !current_) { + if (!current_) { return {}; } diff --git a/Firestore/core/src/core/view.h b/Firestore/core/src/core/view.h index 32ffb9ca3c5..c8331ca9454 100644 --- a/Firestore/core/src/core/view.h +++ b/Firestore/core/src/core/view.h @@ -189,14 +189,15 @@ class View { * @param doc_changes The set of changes to make to the view's docs. * @param target_change A target change to apply for computing limbo docs and * sync state. - * @param waitForRequeryResult - Whether the target is pending to run a full - * re-query due to existence filter mismatch. + * @param targetIsPendingReset - Whether the target is pending to reset due to + existence filter mismatch. If not explicitly specified, it is treated + equivalently to `false`. * @return A new ViewChange with the given docs, changes, and sync state. */ ViewChange ApplyChanges( const core::ViewDocumentChanges& doc_changes, const absl::optional& target_change, - bool waitForRequeryResult); + bool targetIsPendingReset); /** * Applies an OnlineState change to the view, potentially generating an @@ -220,8 +221,7 @@ class View { void ApplyTargetChange( const absl::optional& maybe_target_change); - std::vector UpdateLimboDocuments( - bool waitForRequeryResult); + std::vector UpdateLimboDocuments(); Query query_; From 84723b5689d0602e182c6e0e1d55b74f1c34cf17 Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Mon, 20 Nov 2023 11:34:11 -0500 Subject: [PATCH 7/8] resolve comments + add changelog --- Firestore/CHANGELOG.md | 6 ++++++ Firestore/core/src/core/view.cc | 10 ---------- Firestore/core/src/core/view.h | 25 ++----------------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/Firestore/CHANGELOG.md b/Firestore/CHANGELOG.md index ecd128d5869..ad6da5f8b21 100644 --- a/Firestore/CHANGELOG.md +++ b/Firestore/CHANGELOG.md @@ -1,3 +1,9 @@ +# Unreleased +- [fixed] Fixed an issue in the local cache synchronization logic where all + locally-cached documents that matched a resumed query would be unnecessarily + re-downloaded; with the fix it now only downloads the documents that are known + to be out-of-sync. (#12044) + # 10.18.0 - [fixed] Fix Firestore build for visionOS on Xcode 15.1. (#12023) diff --git a/Firestore/core/src/core/view.cc b/Firestore/core/src/core/view.cc index 5911d962381..c812cb0861e 100644 --- a/Firestore/core/src/core/view.cc +++ b/Firestore/core/src/core/view.cc @@ -246,16 +246,6 @@ bool View::ShouldWaitForSyncedDocument(const Document& new_doc, !new_doc->has_local_mutations()); } -ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes) { - return ApplyChanges(doc_changes, {}); -} - -ViewChange View::ApplyChanges( - const ViewDocumentChanges& doc_changes, - const absl::optional& target_change) { - return ApplyChanges(doc_changes, target_change, false); -} - ViewChange View::ApplyChanges(const ViewDocumentChanges& doc_changes, const absl::optional& target_change, bool targetIsPendingReset) { diff --git a/Firestore/core/src/core/view.h b/Firestore/core/src/core/view.h index c8331ca9454..9cbbe3521e5 100644 --- a/Firestore/core/src/core/view.h +++ b/Firestore/core/src/core/view.h @@ -161,27 +161,6 @@ class View { const absl::optional& previous_changes = absl::nullopt) const; - /** - * Updates the view with the given ViewDocumentChanges. - * - * @param doc_changes The set of changes to make to the view's docs. - * @return A new ViewChange with the given docs, changes, and sync state. - */ - ViewChange ApplyChanges(const core::ViewDocumentChanges& doc_changes); - - /** - * Updates the view with the given ViewDocumentChanges and updates limbo docs - * and sync state from the given (optional) target change. - * - * @param doc_changes The set of changes to make to the view's docs. - * @param target_change A target change to apply for computing limbo docs and - * sync state. - * @return A new ViewChange with the given docs, changes, and sync state. - */ - ViewChange ApplyChanges( - const core::ViewDocumentChanges& doc_changes, - const absl::optional& target_change); - /** * Updates the view with the given ViewDocumentChanges and updates limbo docs * and sync state from the given (optional) target change. @@ -196,8 +175,8 @@ class View { */ ViewChange ApplyChanges( const core::ViewDocumentChanges& doc_changes, - const absl::optional& target_change, - bool targetIsPendingReset); + const absl::optional& target_change = {}, + bool targetIsPendingReset = false); /** * Applies an OnlineState change to the view, potentially generating an From b363bd710dd3d1995e0b95437926bd3563592eaf Mon Sep 17 00:00:00 2001 From: milaGGL <107142260+milaGGL@users.noreply.github.com> Date: Tue, 21 Nov 2023 13:38:34 -0500 Subject: [PATCH 8/8] Update view.h --- Firestore/core/src/core/view.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Firestore/core/src/core/view.h b/Firestore/core/src/core/view.h index 9cbbe3521e5..c6c41b3c8dc 100644 --- a/Firestore/core/src/core/view.h +++ b/Firestore/core/src/core/view.h @@ -175,7 +175,7 @@ class View { */ ViewChange ApplyChanges( const core::ViewDocumentChanges& doc_changes, - const absl::optional& target_change = {}, + const absl::optional& target_change = absl::nullopt, bool targetIsPendingReset = false); /**