Skip to content

C++ migration: port FSTRemoteEvent #2320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 82 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
76b206b
Remove extra imports and includes
var-const Jan 15, 2019
7dcb9ae
Port
var-const Jan 15, 2019
88ba1a7
Forgotten method
var-const Jan 15, 2019
895bf45
style.sh
var-const Jan 15, 2019
b66c5d2
Forgotten the main part!
var-const Jan 15, 2019
3f5fdae
Fixup unit tests
var-const Jan 15, 2019
5ce04b8
Wip
var-const Jan 16, 2019
3dc3170
Step back
var-const Jan 18, 2019
9d1f931
Core compiles
var-const Jan 18, 2019
7ea798e
Merge branch 'master' into varconst/fst-watch-change
var-const Jan 18, 2019
84842be
quick fix
var-const Jan 18, 2019
e5132be
Test helpers
var-const Jan 18, 2019
6c85090
MockDatastore
var-const Jan 18, 2019
f7a90b5
FSTLocalStoreTests
var-const Jan 18, 2019
267963f
wip
var-const Jan 18, 2019
60a5726
wip
var-const Jan 18, 2019
dd9d98d
FSTRemoveEventTests
var-const Jan 18, 2019
aec3f54
FSTSerializerBetaTests
var-const Jan 19, 2019
b012929
wip
var-const Jan 19, 2019
1da0672
wip
var-const Jan 21, 2019
e0f77f2
wip
var-const Jan 21, 2019
df5cd00
wip
var-const Jan 21, 2019
5d3313a
wip
var-const Jan 21, 2019
31e5f3d
wip
var-const Jan 21, 2019
0637243
Ship it!
var-const Jan 21, 2019
26b39c7
use changes
var-const Jan 21, 2019
2cab650
quick fix
var-const Jan 21, 2019
ca88d8c
Unit tests pass
var-const Jan 21, 2019
2c0a7ef
style.sh
var-const Jan 21, 2019
52b131d
Small fixes
var-const Jan 21, 2019
35ce8cc
Get rid of ids alias
var-const Jan 21, 2019
8230fbb
Fixes
var-const Jan 21, 2019
ceb3bee
Move the test
var-const Jan 21, 2019
dd617de
Restore nooutstandingresponses variable
var-const Jan 21, 2019
9d80eea
Small fixes
var-const Jan 21, 2019
836d4de
style.sh
var-const Jan 21, 2019
134acaf
Review feedback
var-const Jan 22, 2019
f8dd5a5
Review feedback
var-const Jan 22, 2019
c02df53
comment
var-const Jan 22, 2019
ce17913
Appease linter
var-const Jan 22, 2019
a87cf7e
Initial
var-const Jan 22, 2019
d6a137a
wip
var-const Jan 23, 2019
1c99679
wip
var-const Jan 23, 2019
b2e0dd1
Initial
var-const Jan 23, 2019
e076f25
style.sh
var-const Jan 23, 2019
359d938
Merge branch 'master' into varconst/fst-document-view-change-type
var-const Jan 23, 2019
4b7c6a7
forgotten file
var-const Jan 23, 2019
7164e2b
Merge branch 'varconst/fst-document-view-change-type' into varconst/f…
var-const Jan 23, 2019
48fbab6
pt. 1 compiles
var-const Jan 23, 2019
0325248
Wip
var-const Jan 23, 2019
acbc626
wip
var-const Jan 24, 2019
b178b00
Merge branch 'master' into varconst/fst-watch-change-aggregator
var-const Jan 24, 2019
78395d8
In theory, all methods implemented
var-const Jan 24, 2019
4fee491
wip
var-const Jan 24, 2019
626efec
Almost compiles
var-const Jan 24, 2019
66db96a
Merge branch 'master' into varconst/fst-watch-change-aggregator
var-const Jan 24, 2019
d5defb1
appease linter
var-const Jan 24, 2019
52b2171
Bring method order into compliance
var-const Jan 24, 2019
e5fcf94
Compliacne, pt.2
var-const Jan 24, 2019
7a48512
core compiles
var-const Jan 25, 2019
66d8af2
unit tests compile
var-const Jan 26, 2019
594a841
Fix unit test -- all pass
var-const Jan 26, 2019
77d9cd7
style.sh
var-const Jan 26, 2019
fdf05a7
Review feedback
var-const Jan 26, 2019
a910ccd
Merge branch 'varconst/fst-watch-change-aggregator' into varconst/fst…
var-const Jan 26, 2019
c71a541
undo formatting
var-const Jan 26, 2019
24a745e
fix
var-const Jan 26, 2019
142f08c
Merge branch 'varconst/fst-watch-change-aggregator' into varconst/fst…
var-const Jan 27, 2019
e402e8b
Merge branch 'master' into varconst/fst-target-change
var-const Jan 27, 2019
e3dd85e
Temp code
var-const Jan 27, 2019
1eb4096
Implementation
var-const Jan 28, 2019
4147c3d
Updating references wip (FSTRemoteEventsTests still to do)
var-const Jan 28, 2019
3b3b012
Unit tests compile
var-const Jan 28, 2019
f1140d9
Unit tests compile and pass
var-const Jan 28, 2019
7ee766f
style.sh
var-const Jan 28, 2019
f00494a
Minor improvements
var-const Jan 28, 2019
766e940
Review feedback
var-const Jan 29, 2019
68ced12
Merge branch 'varconst/fst-target-change' into varconst/fst-remote-ev…
var-const Jan 29, 2019
ab6d050
Merge branch 'master' into varconst/fst-remote-event2
var-const Jan 29, 2019
df4c82e
Pseudochange
var-const Jan 29, 2019
9b494ee
Undo pseudochange
var-const Jan 29, 2019
c5a82f9
unstyle
var-const Jan 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Firestore/Example/Tests/Core/FSTQueryListenerTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#import "Firestore/Source/Core/FSTView.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
#import "Firestore/Source/Util/FSTAsyncQueryListener.h"

#import "Firestore/Example/Tests/Util/FSTHelpers.h"
Expand Down
1 change: 0 additions & 1 deletion Firestore/Example/Tests/Core/FSTViewTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Model/FSTFieldValue.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"

#import "Firestore/Example/Tests/Util/FSTHelpers.h"

Expand Down
14 changes: 8 additions & 6 deletions Firestore/Example/Tests/Integration/FSTDatastoreTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#import <XCTest/XCTest.h>

#include <memory>
#include <vector>

#import "Firestore/Source/API/FIRDocumentReference+Internal.h"
#import "Firestore/Source/API/FSTUserDataConverter.h"
Expand All @@ -29,7 +30,6 @@
#import "Firestore/Source/Model/FSTFieldValue.h"
#import "Firestore/Source/Model/FSTMutation.h"
#import "Firestore/Source/Model/FSTMutationBatch.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
#import "Firestore/Source/Remote/FSTRemoteStore.h"

#import "Firestore/Example/Tests/Util/FSTIntegrationTestCase.h"
Expand All @@ -40,6 +40,7 @@
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/precondition.h"
#include "Firestore/core/src/firebase/firestore/remote/datastore.h"
#include "Firestore/core/src/firebase/firestore/remote/remote_event.h"
#include "Firestore/core/src/firebase/firestore/util/async_queue.h"
#include "Firestore/core/src/firebase/firestore/util/executor_libdispatch.h"
#include "Firestore/core/src/firebase/firestore/util/hard_assert.h"
Expand All @@ -57,6 +58,7 @@
using firebase::firestore::model::TargetId;
using firebase::firestore::remote::Datastore;
using firebase::firestore::remote::GrpcConnection;
using firebase::firestore::remote::RemoteEvent;
using firebase::firestore::util::AsyncQueue;
using firebase::firestore::util::ExecutorLibdispatch;

Expand All @@ -79,17 +81,17 @@ - (void)expectListenEventWithDescription:(NSString *)description;

@property(nonatomic, weak, nullable) XCTestCase *testCase;
@property(nonatomic, strong) NSMutableArray<NSObject *> *writeEvents;
@property(nonatomic, strong) NSMutableArray<NSObject *> *listenEvents;
@property(nonatomic, strong) NSMutableArray<XCTestExpectation *> *writeEventExpectations;
@property(nonatomic, strong) NSMutableArray<XCTestExpectation *> *listenEventExpectations;
@end

@implementation FSTRemoteStoreEventCapture
@implementation FSTRemoteStoreEventCapture {
std::vector<RemoteEvent> _listenEvents;
}

- (instancetype)initWithTestCase:(XCTestCase *_Nullable)testCase {
if (self = [super init]) {
_writeEvents = [NSMutableArray array];
_listenEvents = [NSMutableArray array];
_testCase = testCase;
_writeEventExpectations = [NSMutableArray array];
_listenEventExpectations = [NSMutableArray array];
Expand Down Expand Up @@ -134,8 +136,8 @@ - (DocumentKeySet)remoteKeysForTarget:(TargetId)targetId {
return DocumentKeySet{};
}

- (void)applyRemoteEvent:(FSTRemoteEvent *)remoteEvent {
[self.listenEvents addObject:remoteEvent];
- (void)applyRemoteEvent:(const RemoteEvent &)remoteEvent {
_listenEvents.push_back(remoteEvent);
XCTestExpectation *expectation = [self.listenEventExpectations objectAtIndex:0];
[self.listenEventExpectations removeObjectAtIndex:0];
[expectation fulfill];
Expand Down
6 changes: 3 additions & 3 deletions Firestore/Example/Tests/Local/FSTLocalStoreTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import "Firestore/Source/Model/FSTDocumentSet.h"
#import "Firestore/Source/Model/FSTMutation.h"
#import "Firestore/Source/Model/FSTMutationBatch.h"
#import "Firestore/Source/Remote/FSTRemoteEvent.h"
#import "Firestore/Source/Util/FSTClasses.h"

#import "Firestore/Example/Tests/Local/FSTLocalStoreTests.h"
Expand All @@ -51,6 +50,7 @@
using firebase::firestore::model::MaybeDocumentMap;
using firebase::firestore::model::SnapshotVersion;
using firebase::firestore::model::TargetId;
using firebase::firestore::remote::RemoteEvent;
using firebase::firestore::remote::WatchChangeAggregator;
using firebase::firestore::remote::WatchTargetChange;
using firebase::firestore::remote::WatchTargetChangeState;
Expand Down Expand Up @@ -133,7 +133,7 @@ - (void)writeMutations:(NSArray<FSTMutation *> *)mutations {
_lastChanges = result.changes;
}

- (void)applyRemoteEvent:(FSTRemoteEvent *)event {
- (void)applyRemoteEvent:(const RemoteEvent &)event {
_lastChanges = [self.localStore applyRemoteEvent:event];
}

Expand Down Expand Up @@ -910,7 +910,7 @@ - (void)testPersistsResumeTokens {
providerWithSingleResultForKey:testutil::Key("foo/bar")
targets:{targetID}]};
aggregator.HandleTargetChange(watchChange);
FSTRemoteEvent *remoteEvent = aggregator.CreateRemoteEvent(testutil::Version(1000));
RemoteEvent remoteEvent = aggregator.CreateRemoteEvent(testutil::Version(1000));
[self applyRemoteEvent:remoteEvent];

// Stop listening so that the query should become inactive (but persistent)
Expand Down
Loading