From 8311c6432ecff78bedd13e27f64d241659324786 Mon Sep 17 00:00:00 2001 From: zxu Date: Tue, 6 Mar 2018 14:28:04 -0500 Subject: port paths to FSTDocumentKey (#877) * replace path with C++ implementation in FSTDocumentKey.{h,mm} only * address changes * address changes --- Firestore/Source/Local/FSTLevelDBMutationQueue.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Firestore/Source/Local/FSTLevelDBMutationQueue.mm') diff --git a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm index 9041ddc..1f6484d 100644 --- a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm +++ b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm @@ -375,8 +375,9 @@ static ReadOptions StandardReadOptions() { NSString *userID = self.userID; // Scan the document-mutation index starting with a prefix starting with the given documentKey. - std::string indexPrefix = - [FSTLevelDBDocumentMutationKey keyPrefixWithUserID:self.userID resourcePath:documentKey.path]; + std::string indexPrefix = [FSTLevelDBDocumentMutationKey + keyPrefixWithUserID:self.userID + resourcePath:[FSTResourcePath resourcePathWithCPPResourcePath:documentKey.path]]; std::unique_ptr indexIterator(_db->NewIterator(StandardReadOptions())); indexIterator->Seek(indexPrefix); @@ -467,7 +468,7 @@ static ReadOptions StandardReadOptions() { // Rows with document keys more than one segment longer than the query path can't be matches. // For example, a query on 'rooms' can't match the document /rooms/abc/messages/xyx. // TODO(mcg): we'll need a different scanner when we implement ancestor queries. - if (rowKey.documentKey.path.length != immediateChildrenPathLength) { + if (rowKey.documentKey.path.size() != immediateChildrenPathLength) { continue; } @@ -614,8 +615,9 @@ static ReadOptions StandardReadOptions() { #pragma mark - FSTGarbageSource implementation - (BOOL)containsKey:(FSTDocumentKey *)documentKey { - std::string indexPrefix = - [FSTLevelDBDocumentMutationKey keyPrefixWithUserID:self.userID resourcePath:documentKey.path]; + std::string indexPrefix = [FSTLevelDBDocumentMutationKey + keyPrefixWithUserID:self.userID + resourcePath:[FSTResourcePath resourcePathWithCPPResourcePath:documentKey.path]]; std::unique_ptr indexIterator(_db->NewIterator(StandardReadOptions())); indexIterator->Seek(indexPrefix); -- cgit v1.2.3