aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTLocalDocumentsView.mm
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-23 17:52:01 -0400
committerGravatar GitHub <noreply@github.com>2018-03-23 17:52:01 -0400
commit0ccfd6a3dc77fb733626bc8911b5925ad9475c2e (patch)
treee3d443c4cd7410e09250999dbe0bda07df84d698 /Firestore/Source/Local/FSTLocalDocumentsView.mm
parent6a61d83854fa7f0cc5898ee50c65169583a5b69c (diff)
port C++ `DocumentKey` to `Local/*` (#963)
* port C++ DocumentKey to Local's * address changes
Diffstat (limited to 'Firestore/Source/Local/FSTLocalDocumentsView.mm')
-rw-r--r--Firestore/Source/Local/FSTLocalDocumentsView.mm11
1 files changed, 6 insertions, 5 deletions
diff --git a/Firestore/Source/Local/FSTLocalDocumentsView.mm b/Firestore/Source/Local/FSTLocalDocumentsView.mm
index c059146..e9b9423 100644
--- a/Firestore/Source/Local/FSTLocalDocumentsView.mm
+++ b/Firestore/Source/Local/FSTLocalDocumentsView.mm
@@ -22,13 +22,14 @@
#import "Firestore/Source/Local/FSTRemoteDocumentCache.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentDictionary.h"
-#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTMutation.h"
#import "Firestore/Source/Model/FSTMutationBatch.h"
#import "Firestore/Source/Util/FSTAssert.h"
+#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
+using firebase::firestore::model::DocumentKey;
using firebase::firestore::model::ResourcePath;
NS_ASSUME_NONNULL_BEGIN
@@ -58,7 +59,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (nullable FSTMaybeDocument *)documentForKey:(FSTDocumentKey *)key {
+- (nullable FSTMaybeDocument *)documentForKey:(const DocumentKey &)key {
FSTMaybeDocument *_Nullable remoteDoc = [self.remoteDocumentCache entryForKey:key];
return [self localDocument:remoteDoc key:key];
}
@@ -78,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (FSTDocumentDictionary *)documentsMatchingQuery:(FSTQuery *)query {
- if ([FSTDocumentKey isDocumentKey:query.path]) {
+ if (DocumentKey::IsDocumentKey(query.path)) {
return [self documentsMatchingDocumentQuery:query.path];
} else {
return [self documentsMatchingCollectionQuery:query];
@@ -88,7 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
- (FSTDocumentDictionary *)documentsMatchingDocumentQuery:(const ResourcePath &)docPath {
FSTDocumentDictionary *result = [FSTDocumentDictionary documentDictionary];
// Just do a simple document lookup.
- FSTMaybeDocument *doc = [self documentForKey:[FSTDocumentKey keyWithPath:docPath]];
+ FSTMaybeDocument *doc = [self documentForKey:DocumentKey{docPath}];
if ([doc isKindOfClass:[FSTDocument class]]) {
result = [result dictionaryBySettingObject:(FSTDocument *)doc forKey:doc.key];
}
@@ -148,7 +149,7 @@ NS_ASSUME_NONNULL_BEGIN
* @param documentKey The key of the document (necessary when remoteDocument is nil).
*/
- (nullable FSTMaybeDocument *)localDocument:(nullable FSTMaybeDocument *)document
- key:(FSTDocumentKey *)documentKey {
+ key:(const DocumentKey &)documentKey {
NSArray<FSTMutationBatch *> *batches =
[self.mutationQueue allMutationBatchesAffectingDocumentKey:documentKey];
for (FSTMutationBatch *batch in batches) {