diff options
author | zxu <zxu@google.com> | 2018-04-25 14:13:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 14:13:57 -0400 |
commit | ff32b59036f35512c64fcd75ae5cee8aca228929 (patch) | |
tree | 9b09fff01e1ce3546c25f162f703b782c9fbca61 /Firestore/Source/Remote/FSTRemoteStore.mm | |
parent | f9bd6d3c9491dddbfc9cbe0fcc633030a66fe9da (diff) |
Port `SnapshotVersion` for `Remote` (#1174)
* no-brainer replace FSTSnapshotVersion by SnapshotVersion in `Remote`
* delete `FSTSnapshotVersion` in `Remote`
* fix test
* partially revert RemoteEvent
* Revert "partially revert RemoteEvent"
This reverts commit 67e35bb6c11eaf79608df8d02a60788a40331d0f.
* fix a bug
* fix integration
* address changes
Diffstat (limited to 'Firestore/Source/Remote/FSTRemoteStore.mm')
-rw-r--r-- | Firestore/Source/Remote/FSTRemoteStore.mm | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Firestore/Source/Remote/FSTRemoteStore.mm b/Firestore/Source/Remote/FSTRemoteStore.mm index 39d285a..4dacc8e 100644 --- a/Firestore/Source/Remote/FSTRemoteStore.mm +++ b/Firestore/Source/Remote/FSTRemoteStore.mm @@ -19,7 +19,6 @@ #include <cinttypes> #import "Firestore/Source/Core/FSTQuery.h" -#import "Firestore/Source/Core/FSTSnapshotVersion.h" #import "Firestore/Source/Core/FSTTransaction.h" #import "Firestore/Source/Local/FSTLocalStore.h" #import "Firestore/Source/Local/FSTQueryData.h" @@ -37,11 +36,13 @@ #include "Firestore/core/src/firebase/firestore/auth/user.h" #include "Firestore/core/src/firebase/firestore/model/document_key.h" +#include "Firestore/core/src/firebase/firestore/model/snapshot_version.h" #include "Firestore/core/src/firebase/firestore/util/string_apple.h" namespace util = firebase::firestore::util; using firebase::firestore::auth::User; using firebase::firestore::model::DocumentKey; +using firebase::firestore::model::SnapshotVersion; NS_ASSUME_NONNULL_BEGIN @@ -299,7 +300,7 @@ static const int kMaxPendingWrites = 10; } - (void)watchStreamDidChange:(FSTWatchChange *)change - snapshotVersion:(FSTSnapshotVersion *)snapshotVersion { + snapshotVersion:(const SnapshotVersion &)snapshotVersion { // Mark the connection as Online because we got a message from the server. [self.onlineStateTracker updateState:FSTOnlineStateOnline]; @@ -315,10 +316,8 @@ static const int kMaxPendingWrites = 10; // older than a previous snapshot we've processed (can happen after we resume a target // using a resume token). [self.accumulatedChanges addObject:change]; - FSTAssert(snapshotVersion, @"snapshotVersion must not be nil."); - if ([snapshotVersion isEqual:[FSTSnapshotVersion noVersion]] || - [snapshotVersion compare:[self.localStore lastRemoteSnapshotVersion]] == - NSOrderedAscending) { + if (snapshotVersion == SnapshotVersion::None() || + snapshotVersion < SnapshotVersion{[self.localStore lastRemoteSnapshotVersion]}) { return; } @@ -354,7 +353,7 @@ static const int kMaxPendingWrites = 10; * on to the SyncEngine. */ - (void)processBatchedWatchChanges:(NSArray<FSTWatchChange *> *)changes - snapshotVersion:(FSTSnapshotVersion *)snapshotVersion { + snapshotVersion:(const SnapshotVersion &)snapshotVersion { FSTWatchChangeAggregator *aggregator = [[FSTWatchChangeAggregator alloc] initWithSnapshotVersion:snapshotVersion listenTargets:self.listenTargets @@ -566,7 +565,7 @@ static const int kMaxPendingWrites = 10; } /** Handles a successful StreamingWriteResponse from the server that contains a mutation result. */ -- (void)writeStreamDidReceiveResponseWithVersion:(FSTSnapshotVersion *)commitVersion +- (void)writeStreamDidReceiveResponseWithVersion:(const SnapshotVersion &)commitVersion mutationResults:(NSArray<FSTMutationResult *> *)results { // This is a response to a write containing mutations and should be correlated to the first // pending write. |