diff options
author | zxu <zxu@google.com> | 2018-02-15 17:23:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-15 17:23:08 -0500 |
commit | fd9fd271d0dba3935a6f5611a1554f2c59b696af (patch) | |
tree | be6d8355254891cb83201c7bfac2082c0f95978f /Firestore/Source/Local/FSTMemoryPersistence.mm | |
parent | 6889850b251ab56186bc13765baee0c3d0f1ae61 (diff) |
replacing Auth/FSTUser by C++ auth implementation (#804)
* replacing Auth/FSTUser by C++ auth implementation
* address changes
Diffstat (limited to 'Firestore/Source/Local/FSTMemoryPersistence.mm')
-rw-r--r-- | Firestore/Source/Local/FSTMemoryPersistence.mm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/Firestore/Source/Local/FSTMemoryPersistence.mm b/Firestore/Source/Local/FSTMemoryPersistence.mm index e301820..ba71f9c 100644 --- a/Firestore/Source/Local/FSTMemoryPersistence.mm +++ b/Firestore/Source/Local/FSTMemoryPersistence.mm @@ -16,7 +16,8 @@ #import "Firestore/Source/Local/FSTMemoryPersistence.h" -#import "Firestore/Source/Auth/FSTUser.h" +#include <unordered_map> + #import "Firestore/Source/Local/FSTMemoryMutationQueue.h" #import "Firestore/Source/Local/FSTMemoryQueryCache.h" #import "Firestore/Source/Local/FSTMemoryRemoteDocumentCache.h" @@ -24,12 +25,15 @@ #import "Firestore/Source/Local/FSTWriteGroupTracker.h" #import "Firestore/Source/Util/FSTAssert.h" +#include "Firestore/core/src/firebase/firestore/auth/user.h" + +using firebase::firestore::auth::HashUser; +using firebase::firestore::auth::User; + NS_ASSUME_NONNULL_BEGIN @interface FSTMemoryPersistence () @property(nonatomic, strong, nonnull) FSTWriteGroupTracker *writeGroupTracker; -@property(nonatomic, strong, nonnull) - NSMutableDictionary<FSTUser *, id<FSTMutationQueue>> *mutationQueues; @property(nonatomic, assign, getter=isStarted) BOOL started; @end @@ -46,6 +50,8 @@ NS_ASSUME_NONNULL_BEGIN /** The FSTRemoteDocumentCache representing the persisted cache of remote documents. */ FSTMemoryRemoteDocumentCache *_remoteDocumentCache; + + std::unordered_map<User, id<FSTMutationQueue>, HashUser> _mutationQueues; } + (instancetype)persistence { @@ -57,7 +63,6 @@ NS_ASSUME_NONNULL_BEGIN _writeGroupTracker = [FSTWriteGroupTracker tracker]; _queryCache = [[FSTMemoryQueryCache alloc] init]; _remoteDocumentCache = [[FSTMemoryRemoteDocumentCache alloc] init]; - _mutationQueues = [NSMutableDictionary dictionary]; } return self; } @@ -75,11 +80,11 @@ NS_ASSUME_NONNULL_BEGIN self.started = NO; } -- (id<FSTMutationQueue>)mutationQueueForUser:(FSTUser *)user { - id<FSTMutationQueue> queue = self.mutationQueues[user]; +- (id<FSTMutationQueue>)mutationQueueForUser:(const User &)user { + id<FSTMutationQueue> queue = _mutationQueues[user]; if (!queue) { queue = [FSTMemoryMutationQueue mutationQueue]; - self.mutationQueues[user] = queue; + _mutationQueues[user] = queue; } return queue; } |