aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase
diff options
context:
space:
mode:
authorGravatar Konstantin Varlamov <var-const@users.noreply.github.com>2018-07-16 18:20:00 -0400
committerGravatar GitHub <noreply@github.com>2018-07-16 18:20:00 -0400
commit6ab0195f11e9a0daab46babf7f894bb08b2ae9c3 (patch)
tree0480fffac31bf4854c5aeac0715f82ebee5cdb3c /Firestore/core/src/firebase
parente9b56959f1be44bbf787ad1077d1e1dad1aa29fe (diff)
Minimize rereading of batches in FSTLocalDocumentsView documentsMatchingCollectionQuery (#1533)
Previously in `documentsMatchingCollectionQuery`, write batches were read three times; in fact, all relevant batches will always be contained inside `allMutationBatchesAffectingQuery` (which is also more efficient); the other two calls were redundant.
Diffstat (limited to 'Firestore/core/src/firebase')
-rw-r--r--Firestore/core/src/firebase/firestore/model/base_path.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Firestore/core/src/firebase/firestore/model/base_path.h b/Firestore/core/src/firebase/firestore/model/base_path.h
index 7608829..31aaebb 100644
--- a/Firestore/core/src/firebase/firestore/model/base_path.h
+++ b/Firestore/core/src/firebase/firestore/model/base_path.h
@@ -139,6 +139,16 @@ class BasePath {
return size() <= rhs.size() && std::equal(begin(), end(), rhs.begin());
}
+ /**
+ * Returns true if the given argument is a direct child of this path.
+ *
+ * Empty path is a parent of any path that consists of a single segment.
+ */
+ bool IsImmediateParentOf(const T& potential_child) const {
+ return size() + 1 == potential_child.size() &&
+ std::equal(begin(), end(), potential_child.begin());
+ }
+
bool operator==(const BasePath& rhs) const {
return segments_ == rhs.segments_;
}