aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Core
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-24 11:06:32 -0400
committerGravatar GitHub <noreply@github.com>2018-03-24 11:06:32 -0400
commitb3050e42d842a4aef122efd277481c46bfa88dff (patch)
treed18994e8d1c85d726ca3007f86ade676e70242b6 /Firestore/Source/Core
parent38170347b9f71798602f652e20404b565d4bd049 (diff)
port C++ `DocumentKey` to `Remote/*` (#965)
* port C++ DocumentKey to Remote's * port C++ DocumentKey to Remote's * address changes * address changes * address changes
Diffstat (limited to 'Firestore/Source/Core')
-rw-r--r--Firestore/Source/Core/FSTSyncEngine.mm6
-rw-r--r--Firestore/Source/Core/FSTTransaction.h6
-rw-r--r--Firestore/Source/Core/FSTTransaction.mm6
3 files changed, 12 insertions, 6 deletions
diff --git a/Firestore/Source/Core/FSTSyncEngine.mm b/Firestore/Source/Core/FSTSyncEngine.mm
index d567878..b1f138a 100644
--- a/Firestore/Source/Core/FSTSyncEngine.mm
+++ b/Firestore/Source/Core/FSTSyncEngine.mm
@@ -300,7 +300,7 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
FSTTargetChange *_Nonnull targetChange, BOOL *_Nonnull stop) {
FSTDocumentKey *limboKey = self.limboKeysByTarget[targetID];
if (limboKey && targetChange.currentStatusUpdate == FSTCurrentStatusUpdateMarkCurrent &&
- remoteEvent.documentUpdates[limboKey] == nil) {
+ remoteEvent.documentUpdates.find(limboKey) == remoteEvent.documentUpdates.end()) {
// When listening to a query the server responds with a snapshot containing documents
// matching the query and a current marker telling us we're now in sync. It's possible for
// these to arrive as separate remote events or as a single remote event. For a document
@@ -363,11 +363,9 @@ static const FSTListenSequenceNumber kIrrelevantSequenceNumber = -1;
[NSMutableDictionary dictionary];
FSTDeletedDocument *doc =
[FSTDeletedDocument documentWithKey:limboKey version:[FSTSnapshotVersion noVersion]];
- NSMutableDictionary<FSTDocumentKey *, FSTMaybeDocument *> *docUpdate =
- [NSMutableDictionary dictionaryWithObject:doc forKey:limboKey];
FSTRemoteEvent *event = [FSTRemoteEvent eventWithSnapshotVersion:[FSTSnapshotVersion noVersion]
targetChanges:targetChanges
- documentUpdates:docUpdate];
+ documentUpdates:{{limboKey, doc}}];
[self applyRemoteEvent:event];
} else {
FSTQueryView *queryView = self.queryViewsByTarget[targetID];
diff --git a/Firestore/Source/Core/FSTTransaction.h b/Firestore/Source/Core/FSTTransaction.h
index d4f3d8d..4e5441b 100644
--- a/Firestore/Source/Core/FSTTransaction.h
+++ b/Firestore/Source/Core/FSTTransaction.h
@@ -16,8 +16,12 @@
#import <Foundation/Foundation.h>
+#include <vector>
+
#import "Firestore/Source/Core/FSTTypes.h"
+#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+
@class FIRSetOptions;
@class FSTDatastore;
@class FSTDocumentKey;
@@ -42,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
* Takes a set of keys and asynchronously attempts to fetch all the documents from the backend,
* ignoring any local changes.
*/
-- (void)lookupDocumentsForKeys:(NSArray<FSTDocumentKey *> *)keys
+- (void)lookupDocumentsForKeys:(const std::vector<firebase::firestore::model::DocumentKey> &)keys
completion:(FSTVoidMaybeDocumentArrayErrorBlock)completion;
/**
diff --git a/Firestore/Source/Core/FSTTransaction.mm b/Firestore/Source/Core/FSTTransaction.mm
index b980a4e..58f2dd7 100644
--- a/Firestore/Source/Core/FSTTransaction.mm
+++ b/Firestore/Source/Core/FSTTransaction.mm
@@ -16,6 +16,8 @@
#import "Firestore/Source/Core/FSTTransaction.h"
+#include <vector>
+
#import <GRPCClient/GRPCCall.h>
#import "FIRFirestoreErrors.h"
@@ -32,6 +34,8 @@
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+using firebase::firestore::model::DocumentKey;
+
NS_ASSUME_NONNULL_BEGIN
#pragma mark - FSTTransaction
@@ -99,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
}
}
-- (void)lookupDocumentsForKeys:(NSArray<FSTDocumentKey *> *)keys
+- (void)lookupDocumentsForKeys:(const std::vector<DocumentKey> &)keys
completion:(FSTVoidMaybeDocumentArrayErrorBlock)completion {
[self ensureCommitNotCalled];
if (self.mutations.count) {