Commit Graph
61 Commits
Author SHA1 Message Date
Sebastian Schmidt eb21690b80 Remove SimpleQueryEngine (#7038) 2020-11-26 09:49:25 -07:00
Konstantin Varlamov 2311c36dbc Integrate Firestore with Firebase platform logging (#6507)
The sample user agent string I'm getting in XCode is `apple-platform/ios apple-sdk/17E8258 fire-fst/1.17.1 fire-ios/6.10.2 swift/true xcode/11E503a`.
2020-09-25 15:47:20 -04:00
Sebastian Schmidt 24a77d04c8 Import Spec tests (#6525)
* Import Spec tests

* Init

* Add recovery specs

* Update FSTSyncEngineTestDriver.mm
2020-09-22 18:48:04 -07:00
Sebastian Schmidt 296a1ea1da Reset backoff when connectivity status changes (#5857) 2020-06-22 15:49:12 -07:00
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Denver Coneybeare cd6d0f1c1d Implement limbo resolution listen throttling (#5310) 2020-04-15 12:01:09 -04:00
Denver Coneybeare b05e9eb68d Update spec tests from changes in the firebase-js-sdk respository (#5278) 2020-04-07 10:10:26 -04:00
Gil d9b7a33f0c Use forward declarations instead of IWYU (#4868)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h

* Add forward declaration headers for api, core, and model

These centralize forward declarations, including declarations for some
hard-to-forward-declare types.

* Move includes of hard_assert.h out of other headers

* Make testutil definitions out of line

* Move definitions out-of-line

* Move DocumentKey definitions out-of-line

* Move definitions out-of-line

* Shorten unnecessarily long namespace usages

* Use default destructors where possible

* Delete unused MutationBatch::kUnknown constant

* Use forward declarations instead of IWYU

* Misc fixups from Linux/GCC 9.2.1

* Fix testutil under VS 2017

Forward declarations of functions local to a function body end up
generating unresolved externals. Reduce most of these back to just
calling FieldValue::FromX methods.
2020-02-15 14:34:38 -08:00
wu-hui 51e17ac8c5 Rename QueryData|Cache to TargetData|Cache (#4670)
* Rename done by CLion

QueryCache -> TargetCache
QueryData -> TargetData

* Fix cmake list indention

* Fixing ordering.
2020-01-15 13:47:26 -05:00
Sebastian Schmidt 423a62f874 Enable Index-Free queries (#4618) 2020-01-09 16:40:47 -08:00
Gil 6cc1a449ea Clean up Objective-C interop and other dead code (#4601)
* Remove unused -[FIRFirestore isLoggingEnabled]

Use util::LogIsLoggable(util::kLogLevelDebug) directly.

* Remove objc_compatibility.h

* Remove/cleanup unused #if __OBJC__ blocks

* Remove dead code

* Remove MakeNSStringNoCopy

* Remove worthless include

* Tidy up FIRFirestore

* Remove dead code and use forward declarations in FSTHelpers

* Minor fixes for LevelDbTransaction:

  * Make methods const where possible
  * Make key() and value() return const std::string&, allowing callers
    to create their own const references

* Remove Comparator<NSString*>
2020-01-08 18:40:29 -08:00
wu-hui 14e28121e2 Release LimitToLast (#4616)
* [1/4] Split Query and Target, and make LocalStore/RemoteStore work with Target. (#4413)

* [2/4]LimitToLast: Make SyncEngine work with Target (#4491)

* [3/4] Implement LimitToLast (#4505)
2020-01-08 09:04:28 -08:00
Sebastian Schmidt d261cdeb9b Finish Index-Free queries (still disabled) (#4484) 2020-01-07 13:29:20 -08:00
Gil 971445ce35 Add cross-platform support for creating Executors (#3897)
* Add Executor::CreateSerial

... a standard way to create an Executor for most cases where we don't
care about the implementation.

* Add ExecutorForTesting/AsyncQueueForTesting

Uses Executor::CreateSerial to do the heavy lifting.

* Use AsyncQueueForTesting

* Avoid direct references to ExecutorLibdispatch in prod code

* Rewrite time_testing in terms of absl::Time

* Migrate async_test_util's now to time_testing

* Fix AddressSanitizer stack-buffer-underflow error

This was reading random data off the stack until it hit a negative
integer's worth of data. The test passed because this was generating the
input and expected values, which were much longer than expected given
the input.
2019-09-26 10:41:36 -07:00
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -04:00
wu-hui b48636bf52 Port local store to C++ 2/2 (#3865)
Complete LocalStore port.
2019-09-18 14:00:32 -04:00
Gil 6ad473ae04 Merge persistence-master to master (#3829)
* Port FSTMemoryPersistence to C++ (#3754)

* Add local::Persistence

* Add MemoryPersistence

* Add MemoryEagerReferenceDelegate

* Make LruDelegate extend ReferenceDelegate

This enables downcasting to LruDelegate in tests that need to do so.

* Add MemoryLruReferenceDelegate

* Don't double-count document key size.

* Port FSTLevelDB to C++ (#3755)

* Add LevelDbPersistence

Note that Apple-specific initialization has been partitioned off in
anticipation of being able to run this code on non-Apple platforms.

* Add LevelDbLruReferenceDelegate

* Migrate to C++ Persistence (1/2) (#3756)

* Use C++ Persistence classes in FSTLocalStore

* Remove ReferenceDelegateBridge

* Cut src over to C++ persistence types

* Remove Objective-C requirement from some classes

... that no longer require it.

* Migrate to C++ Persistence (2/2) (#3757)

* Remove LruDelegateBridge

* Update test initialization of persistence components

In particular, ensure that there's always an owner for the Persistence
instance, which wasn't always handled explicitly in the Objective-C
version of the tests.

* Largely mechanical changes to tests

* Remove Objective-C persistence classes

* Forward declare util::Status when possible (#3761)

* Add a header dedicated to forward declarations for util::Status

* Use status_fwd.h wherever possible
2019-09-12 14:28:10 -07:00
wu-hui 1ce982de85 Port FSTSyncEngine to C++ SyncEngine 2/2 (#3741) 2019-09-05 18:40:58 -04:00
Gil 2e5e8b5676 Migrate FSTQueryData to C++ QueryData (#3595)
* Migrate FSTQueryData to C++ QueryData

* Remove FSTQueryData
2019-08-20 14:56:32 -07:00
Gil 9c35050270 Migrate FSTMutation to C++ Mutations (#3564)
* Nontrivial edits

* Mostly mechanical edits

* Remove FSTMutation
2019-08-14 23:18:47 -07:00
wu-hui 935a515546 Port FSTEventManager to C++ (#3539)
* Initial version of c++ event manager

* Addressing comments - DelayedConstructor

* DelayedConstructor

* formatting

* final fixing
2019-08-12 16:44:09 -04:00
Hui-Wu 902d9fe4c5 Port public shutdown (#3467)
* async_queue shutdown ready

* shutdown feature complete. need to fix shared_ptr for credprovider and stop executor leakage.

* stop executor leakage.

* Improved comments without shared_from_this

* shared_ptr everywhere!

* undo scheme change

* addressing comments #1

* addressing comments

* addressing comments #3
2019-08-06 20:33:08 -04:00
Gil 13a1b33913 Migrate from FSTQuery to C++ Query (#3484) 2019-08-02 11:35:33 -07:00
Konstantin Varlamov 76b8da658e Rename FirestoreErrorCode to just Error (#3460) 2019-07-30 21:44:56 -04:00
Gil 07b5eadf5a Rename WrapNSString to MakeNSString (#3274)
This makes it match the convention we've established for other
converters of this type. WrapNSString was perhaps the earliest of these
that we wrote and the convention hadn't yet been established.
2019-06-27 17:31:17 -07:00
Brian Chen 03130acf37 Change AsyncQueue to used shared_ptr instead of raw pointers (#3004) 2019-05-17 15:29:30 -07:00
Gil ff8032ada0 Move the util::objc namespace to just objc (#2865)
* Move the util::objc namespace to just objc

This removes all the namespace objc = firebase::firestore::util::objc
gunk to make it seem as if this was really the arrangement.

This is motivated by wanting to put additional things in this namespace
and use them in headers without having to use util::objc::Foo

* Add CMake support for header-only cc_library targets

* Have the linter allow #include <objc/objc.h>, a C header
2019-04-19 10:02:21 -07:00
Gil 7a7eced747 Don't use using statements in Objective-C headers ... (#2827)
use namespace aliases instead.

This makes the Objective-C code much more like what it's going to end up
being like when translated to C++: headers will include classes declared
in a namespace relative to firebase::firestore so everything else will
be named relative to firebase::firestore.

Meanwhile the using statements in the headers were causing us to miss
adding using statements in source files which was moving us away from
where we wanted to be.
2019-04-12 17:03:26 -07:00
Gil ba332be794 Port FSTAsyncQueryListener to C++ (#2620)
* Test that shows a leak.

* Add EventListener to match Android.

* Use AsyncEventListener in FSTQueryListenerTests

* Remove FSTAsyncQueryListener

* Use EventListener throughout
2019-03-26 11:54:03 -07:00
Gil 315effec4a Port FSTQueryListener to C++ (#2618) 2019-03-26 07:11:02 -07:00
Gil ce07f8d0c3 Port FSTListenOptions to C++ (#2617) 2019-03-25 20:01:20 -07:00
Konstantin Varlamov 48009aaf7d C++ migration: port FSTViewSnapshot (#2441)
Also add a version of `ToString` taking an `absl::optional`
2019-03-01 14:16:41 -05:00
Konstantin Varlamov 13a7066403 C++ migration: eliminate FSTRemoteStore (#2338) 2019-02-08 14:37:42 -05:00
Konstantin Varlamov a22b4cd08e Pass FSTMutations using a vector (#2357) 2019-02-07 22:03:17 -05:00
Konstantin Varlamov 9b3654b156 C++ migration: port write stream-related part of FSTRemoteStore (#2335) 2019-02-06 20:23:29 -05:00
Konstantin Varlamov 456e8eb0f2 C++ migration: port watch stream-related part of FSTRemoteStore (#2331) 2019-02-03 18:01:52 -05:00
Konstantin Varlamov 61f173eb12 C++ migration: port FSTOnlineStateTracker (#2325) 2019-02-01 15:44:18 -05:00
Konstantin Varlamov acb222026a C++ migration: port FSTWatchChange. (#2300) 2019-01-23 17:26:49 -05:00
Konstantin Varlamov 919be7eb88 C++ migration: port FSTDatastore and FSTMockDatastore (#2267) 2019-01-18 13:58:23 -05:00
Paul Beusterien 7c53489e03 Travis to Xcode 10.1 and clang-format to 8.0.0 (tags/google/stable/2018-08-24) (#2222)
* Travis to Xcode 10.1
* Update to clang-format 8
* Update clang-format homebrew link
* Work around space in filename style.sh issue
2019-01-02 09:27:31 -08:00
Konstantin Varlamov 673b08592a C++: replace FSTMaybeDocumentDictionary with a C++ equivalent (#2139)
Also eliminate most usages of `FSTDocumentKey`, remove most methods from the Objective-C class and make it just a wrapper over `DocumentKey`. The only usage that cannot be directly replaced by C++ `DocumentKey` is in `FSTFieldValue`.
2018-12-10 11:57:08 -08:00
Konstantin Varlamov e0d797515c C++: eliminate FSTDispatchQueue and replace it with AsyncQueue (#2062)
* replace all references to `FSTDispatchQueue` and `FSTTimerID` with their C++ equivalents;
* remove `FSTDispatchQueue` class and related tests;
* in method argument names, replace `workerDispatchQueue` with just `workerQueue`, more similar to other platforms;
* move `Executor` and derived classes out of `internal` namespace.
2018-11-18 17:49:32 -05:00
Konstantin Varlamov 8b1efabd82 gRPC: replace Objective-C implementation with the new C++ implementation (#2068)
* Revert "Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)"

This reverts commit ea567dca47.

* gRPC: fix bugs found during testing (#2039)

All in `GrpcStream`:
* make sure there are no pending completions when "finish" operation is enqueued;
* always finish gRPC calls;
* when connectivity changes, reset not just the calls, but the underlying channel as well.

* Revert "Partially revert "Update CHANGELOG for Firestore v0.14.0 (#2025)" (#2031)"

This reverts commit b2437b80f6.

* Update changelog for v0.15.0.

* gRPC: add gRPC wrapper classes to CMake build (#2015)

* add a C++ equivalent of `FIRFirestoreVersionString`. This eliminates the only Objective-C dependency of `grpc_connection.mm` and allows making it a pure C++ file;
* open-source `binary_to_array.py` script and use it in the build to embed `roots.pem` certificate file from gRPC into the Firestore binary. The embedded char array is then used to load certificate at runtime.

* Revert local change -- do not enable sanitizers by default
2018-11-13 11:51:06 -08:00
Gil ea567dca47 Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)
This reverts commit a514bd957a.
2018-11-01 08:37:32 -07:00
Konstantin Varlamov a514bd957a gRPC: replace Objective-C implementation with the new C++ implementation (#1968)
* add support for SSL disabled to `GrpcConnection` (unfortunately, there
  currently is no way to verify this change actually works);
* make gRPC calls using the C++ implementation:
* make `FSTRemoteStore` create C++ streams instead of their Objective-C
  counterparts;
* port https://github.com/firebase/firebase-js-sdk/pull/1041: streams
  are now never recreated, only restarted;
* make `FSTDatastore` delegate server calls to the C++ implementation;
* port `MockWatchStream` and `MockWriteStream` to C++ (`FSTMockDatastore` is
  still in place, because `Datastore` is not fully ported yet);
* no longer generate Objective-C gRPC service definitions from protos;
* remove all references to Objective-C gRPC client;
* check in gRPC root certificates file and load it at runtime (the check-in part
  is temporary until gRPC-C++.podspec provides the certificate). This makes SSL
  work.
2018-10-25 20:13:03 -04:00
Greg Soltis 43d15ecdf7 Start restarting persistence in spec tests (#1713)
* Update json files

* Start restarting persistence in spec tests
2018-08-28 13:40:41 -07:00
Gil 9fc23fb755 Migrate FSTOnlineState to C++ OnlineState (#1705) 2018-08-16 15:24:51 -07:00
Gil 0725a5d4bb Migrate FSTTargetID to C++ TargetId (#1697) 2018-08-15 15:56:45 -07:00
Michael Lehenbauer 186591d402 firebase-ios-sdk/1499: Restart streams on any token change. (#1692)
[Port of https://github.com/firebase/firebase-js-sdk/pull/1120]

Fixes #1499.

This reworks our "user listener" into a "credential change listener" that
fires on any token change, even if the User did not change. This allows
us to restart our streams (but not switch mutation queues, etc.) on token
changes.
2018-08-14 17:22:35 -07:00
Sebastian Schmidt d9b50374ab Add multi-client support to the iOS spec runner (#1631) 2018-08-03 17:06:04 -07:00