diff options
author | zxu <zxu@google.com> | 2018-03-23 17:52:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-23 17:52:01 -0400 |
commit | 0ccfd6a3dc77fb733626bc8911b5925ad9475c2e (patch) | |
tree | e3d443c4cd7410e09250999dbe0bda07df84d698 /Firestore/Source/Local/FSTLevelDBQueryCache.mm | |
parent | 6a61d83854fa7f0cc5898ee50c65169583a5b69c (diff) |
port C++ `DocumentKey` to `Local/*` (#963)
* port C++ DocumentKey to Local's
* address changes
Diffstat (limited to 'Firestore/Source/Local/FSTLevelDBQueryCache.mm')
-rw-r--r-- | Firestore/Source/Local/FSTLevelDBQueryCache.mm | 12 |
1 files changed, 7 insertions, 5 deletions
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; } } |