aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTLocalStore.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/FSTLocalStore.mm
parent6a61d83854fa7f0cc5898ee50c65169583a5b69c (diff)
port C++ `DocumentKey` to `Local/*` (#963)
* port C++ DocumentKey to Local's * address changes
Diffstat (limited to 'Firestore/Source/Local/FSTLocalStore.mm')
-rw-r--r--Firestore/Source/Local/FSTLocalStore.mm13
1 files changed, 7 insertions, 6 deletions
diff --git a/Firestore/Source/Local/FSTLocalStore.mm b/Firestore/Source/Local/FSTLocalStore.mm
index f61a20f..922f281 100644
--- a/Firestore/Source/Local/FSTLocalStore.mm
+++ b/Firestore/Source/Local/FSTLocalStore.mm
@@ -34,7 +34,6 @@
#import "Firestore/Source/Local/FSTWriteGroup.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/Remote/FSTRemoteEvent.h"
@@ -43,8 +42,10 @@
#include "Firestore/core/src/firebase/firestore/auth/user.h"
#include "Firestore/core/src/firebase/firestore/core/target_id_generator.h"
+#include "Firestore/core/src/firebase/firestore/model/document_key.h"
using firebase::firestore::auth::User;
+using firebase::firestore::model::DocumentKey;
using firebase::firestore::core::TargetIdGenerator;
NS_ASSUME_NONNULL_BEGIN
@@ -387,7 +388,7 @@ NS_ASSUME_NONNULL_BEGIN
return [self.mutationQueue nextMutationBatchAfterBatchID:batchID];
}
-- (nullable FSTMaybeDocument *)readDocument:(FSTDocumentKey *)key {
+- (nullable FSTMaybeDocument *)readDocument:(const DocumentKey &)key {
return [self.localDocuments documentForKey:key];
}
@@ -458,9 +459,9 @@ NS_ASSUME_NONNULL_BEGIN
FSTWriteGroup *group = [self.persistence startGroupWithAction:@"Garbage Collection"];
// Call collectGarbage regardless of whether isGCEnabled so the referenceSet doesn't continue to
// accumulate the garbage keys.
- NSSet<FSTDocumentKey *> *garbage = [self.garbageCollector collectGarbage];
- if (garbage.count > 0) {
- for (FSTDocumentKey *key in garbage) {
+ std::set<DocumentKey> garbage = [self.garbageCollector collectGarbage];
+ if (garbage.size() > 0) {
+ for (const DocumentKey &key : garbage) {
[self.remoteDocumentCache removeEntryForKey:key group:group];
}
}
@@ -527,7 +528,7 @@ NS_ASSUME_NONNULL_BEGIN
for (FSTMutationBatch *batch in batches) {
for (FSTMutation *mutation in batch.mutations) {
- FSTDocumentKey *key = mutation.key;
+ const DocumentKey &key = mutation.key;
affectedDocs = [affectedDocs setByAddingObject:key];
}
}