diff options
author | zxu <zxu@google.com> | 2018-05-01 13:37:53 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-01 13:37:53 -0400 |
commit | 4e1ffe464900a45915a3a0a4f2a331b5824c24df (patch) | |
tree | c3586f3d840f4b21a4e4643a46fe94f2443d3959 /Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm | |
parent | 51be76700c3b71a0924e8eaf7bac4b02e0130e62 (diff) |
Port `SnapshotVersion` for the rest Firestore modulo (#1185)
* remove conversions in `Local` and `Remote`
* replace `FSTSnapshotVersion` in `Model`
* replace `FSTSnapshotVersion` in the rest
* let test check equal with C++ equal
* fix newly added code
* address changes
Diffstat (limited to 'Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm')
-rw-r--r-- | Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm index 6715b24..263ca22 100644 --- a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm +++ b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm @@ -16,7 +16,6 @@ #import "Firestore/Example/Tests/SpecTests/FSTMockDatastore.h" -#import "Firestore/Source/Core/FSTSnapshotVersion.h" #import "Firestore/Source/Local/FSTQueryData.h" #import "Firestore/Source/Model/FSTMutation.h" #import "Firestore/Source/Remote/FSTSerializerBeta.h" @@ -36,6 +35,7 @@ using firebase::firestore::auth::CredentialsProvider; using firebase::firestore::auth::EmptyCredentialsProvider; using firebase::firestore::core::DatabaseInfo; using firebase::firestore::model::DatabaseId; +using firebase::firestore::model::SnapshotVersion; @class GRPCProtoCall; @@ -120,9 +120,8 @@ NS_ASSUME_NONNULL_BEGIN FSTLog(@"watchQuery: %d: %@", query.targetID, query.query); self.datastore.watchStreamRequestCount += 1; // Snapshot version is ignored on the wire - FSTQueryData *sentQueryData = - [query queryDataByReplacingSnapshotVersion:[FSTSnapshotVersion noVersion] - resumeToken:query.resumeToken]; + FSTQueryData *sentQueryData = [query queryDataByReplacingSnapshotVersion:SnapshotVersion::None() + resumeToken:query.resumeToken]; self.activeTargets[@(query.targetID)] = sentQueryData; } @@ -138,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Helper methods. -- (void)writeWatchChange:(FSTWatchChange *)change snapshotVersion:(FSTSnapshotVersion *)snap { +- (void)writeWatchChange:(FSTWatchChange *)change snapshotVersion:(const SnapshotVersion &)snap { if ([change isKindOfClass:[FSTWatchTargetChange class]]) { FSTWatchTargetChange *targetChange = (FSTWatchTargetChange *)change; if (targetChange.cause) { @@ -242,7 +241,7 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - Helper methods. /** Injects a write ack as though it had come from the backend in response to a write. */ -- (void)ackWriteWithVersion:(FSTSnapshotVersion *)commitVersion +- (void)ackWriteWithVersion:(const SnapshotVersion &)commitVersion mutationResults:(NSArray<FSTMutationResult *> *)results { [self.delegate writeStreamDidReceiveResponseWithVersion:commitVersion mutationResults:results]; } @@ -326,7 +325,7 @@ NS_ASSUME_NONNULL_BEGIN return [self.writeStream sentMutationsCount]; } -- (void)ackWriteWithVersion:(FSTSnapshotVersion *)commitVersion +- (void)ackWriteWithVersion:(const SnapshotVersion &)commitVersion mutationResults:(NSArray<FSTMutationResult *> *)results { [self.writeStream ackWriteWithVersion:commitVersion mutationResults:results]; } @@ -340,11 +339,11 @@ NS_ASSUME_NONNULL_BEGIN [FSTWatchTargetChange changeWithState:FSTWatchTargetChangeStateAdded targetIDs:targetIDs cause:nil]; - [self writeWatchChange:change snapshotVersion:[FSTSnapshotVersion noVersion]]; + [self writeWatchChange:change snapshotVersion:SnapshotVersion::None()]; } - (void)writeWatchCurrentWithTargetIDs:(NSArray<FSTBoxedTargetID *> *)targetIDs - snapshotVersion:(FSTSnapshotVersion *)snapshotVersion + snapshotVersion:(const SnapshotVersion &)snapshotVersion resumeToken:(NSData *)resumeToken { FSTWatchTargetChange *change = [FSTWatchTargetChange changeWithState:FSTWatchTargetChangeStateCurrent @@ -353,7 +352,7 @@ NS_ASSUME_NONNULL_BEGIN [self writeWatchChange:change snapshotVersion:snapshotVersion]; } -- (void)writeWatchChange:(FSTWatchChange *)change snapshotVersion:(FSTSnapshotVersion *)snap { +- (void)writeWatchChange:(FSTWatchChange *)change snapshotVersion:(const SnapshotVersion &)snap { [self.watchStream writeWatchChange:change snapshotVersion:snap]; } |