aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTLevelDBMutationQueue.mm
diff options
context:
space:
mode:
authorGravatar zxu <zxu@google.com>2018-03-14 08:57:31 -0400
committerGravatar GitHub <noreply@github.com>2018-03-14 08:57:31 -0400
commit9e815620e9f7f43b42e03db4e5118d7ad03ddee7 (patch)
tree86f362bad99281325fca7ee3ae116b6a0f36d511 /Firestore/Source/Local/FSTLevelDBMutationQueue.mm
parentd4d73ea53ecdf1e8ade3d00921419645dd5d66f7 (diff)
grand PR to port the remaining paths (FieldPath and ResourcePath). (#865)
* naively remove FSTPath import and source/test files. * port FieldPath, part I * port FieldPath, part II * port ResourcePath, part I * port ResourcePath, part II * the grand commit to fix build errors * use testutil:: helper instead of those from FSTHelpers * fix test and lint * use c_str in errmsg directly * fix * fix * make code clean * fix integration test I missed * fix to avoid naming collision in preprocessor * address changes * address changes * address changes * fix: fieldMask are actually shared with different context. * address changes * address changes
Diffstat (limited to 'Firestore/Source/Local/FSTLevelDBMutationQueue.mm')
-rw-r--r--Firestore/Source/Local/FSTLevelDBMutationQueue.mm17
1 files changed, 8 insertions, 9 deletions
diff --git a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm
index d7b5eca..ac93ab1 100644
--- a/Firestore/Source/Local/FSTLevelDBMutationQueue.mm
+++ b/Firestore/Source/Local/FSTLevelDBMutationQueue.mm
@@ -30,10 +30,10 @@
#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTMutation.h"
#import "Firestore/Source/Model/FSTMutationBatch.h"
-#import "Firestore/Source/Model/FSTPath.h"
#import "Firestore/Source/Util/FSTAssert.h"
#include "Firestore/core/src/firebase/firestore/auth/user.h"
+#include "Firestore/core/src/firebase/firestore/model/resource_path.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
#include "Firestore/core/src/firebase/firestore/util/string_util.h"
@@ -42,6 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
namespace util = firebase::firestore::util;
using Firestore::StringView;
using firebase::firestore::auth::User;
+using firebase::firestore::model::ResourcePath;
using leveldb::DB;
using leveldb::Iterator;
using leveldb::ReadOptions;
@@ -380,9 +381,8 @@ static ReadOptions StandardReadOptions() {
NSString *userID = self.userID;
// Scan the document-mutation index starting with a prefix starting with the given documentKey.
- std::string indexPrefix = [FSTLevelDBDocumentMutationKey
- keyPrefixWithUserID:self.userID
- resourcePath:[FSTResourcePath resourcePathWithCPPResourcePath:documentKey.path]];
+ std::string indexPrefix =
+ [FSTLevelDBDocumentMutationKey keyPrefixWithUserID:self.userID resourcePath:documentKey.path];
std::unique_ptr<Iterator> indexIterator(_db->NewIterator(StandardReadOptions()));
indexIterator->Seek(indexPrefix);
@@ -432,8 +432,8 @@ static ReadOptions StandardReadOptions() {
FSTAssert(![query isDocumentQuery], @"Document queries shouldn't go down this path");
NSString *userID = self.userID;
- FSTResourcePath *queryPath = [FSTResourcePath resourcePathWithCPPResourcePath:query.path];
- int immediateChildrenPathLength = queryPath.length + 1;
+ const ResourcePath &queryPath = query.path;
+ size_t immediateChildrenPathLength = queryPath.size() + 1;
// TODO(mcg): Actually implement a single-collection query
//
@@ -620,9 +620,8 @@ static ReadOptions StandardReadOptions() {
#pragma mark - FSTGarbageSource implementation
- (BOOL)containsKey:(FSTDocumentKey *)documentKey {
- std::string indexPrefix = [FSTLevelDBDocumentMutationKey
- keyPrefixWithUserID:self.userID
- resourcePath:[FSTResourcePath resourcePathWithCPPResourcePath:documentKey.path]];
+ std::string indexPrefix =
+ [FSTLevelDBDocumentMutationKey keyPrefixWithUserID:self.userID resourcePath:documentKey.path];
std::unique_ptr<Iterator> indexIterator(_db->NewIterator(StandardReadOptions()));
indexIterator->Seek(indexPrefix);