From 0ccfd6a3dc77fb733626bc8911b5925ad9475c2e Mon Sep 17 00:00:00 2001 From: zxu Date: Fri, 23 Mar 2018 17:52:01 -0400 Subject: port C++ `DocumentKey` to `Local/*` (#963) * port C++ DocumentKey to Local's * address changes --- Firestore/Source/Local/FSTLevelDBQueryCache.mm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'Firestore/Source/Local/FSTLevelDBQueryCache.mm') diff --git a/Firestore/Source/Local/FSTLevelDBQueryCache.mm b/Firestore/Source/Local/FSTLevelDBQueryCache.mm index c7eecc4..09440e9 100644 --- a/Firestore/Source/Local/FSTLevelDBQueryCache.mm +++ b/Firestore/Source/Local/FSTLevelDBQueryCache.mm @@ -23,14 +23,16 @@ #import "Firestore/Source/Local/FSTLocalSerializer.h" #import "Firestore/Source/Local/FSTQueryData.h" #import "Firestore/Source/Local/FSTWriteGroup.h" -#import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Util/FSTAssert.h" #include "absl/strings/match.h" +#include "Firestore/core/src/firebase/firestore/model/document_key.h" + NS_ASSUME_NONNULL_BEGIN using firebase::firestore::local::LevelDbTransaction; using Firestore::StringView; +using firebase::firestore::model::DocumentKey; using leveldb::DB; using leveldb::Slice; using leveldb::Status; @@ -323,7 +325,7 @@ using leveldb::Status; if (![rowKey decodeKey:indexKey] || rowKey.targetID != targetID) { break; } - FSTDocumentKey *documentKey = rowKey.documentKey; + const DocumentKey &documentKey = rowKey.documentKey; // Delete both index rows [group removeMessageForKey:indexKey]; @@ -356,14 +358,14 @@ using leveldb::Status; #pragma mark - FSTGarbageSource implementation -- (BOOL)containsKey:(FSTDocumentKey *)key { - std::string indexPrefix = [FSTLevelDBDocumentTargetKey keyPrefixWithResourcePath:key.path]; +- (BOOL)containsKey:(const DocumentKey &)key { + std::string indexPrefix = [FSTLevelDBDocumentTargetKey keyPrefixWithResourcePath:key.path()]; auto indexIterator = _db.currentTransaction->NewIterator(); indexIterator->Seek(indexPrefix); if (indexIterator->Valid()) { FSTLevelDBDocumentTargetKey *rowKey = [[FSTLevelDBDocumentTargetKey alloc] init]; - if ([rowKey decodeKey:indexIterator->key()] && [rowKey.documentKey isEqualToKey:key]) { + if ([rowKey decodeKey:indexIterator->key()] && DocumentKey{rowKey.documentKey} == key) { return YES; } } -- cgit v1.2.3