* 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.
* 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
The problem was essentially that each test instance was deleting the
documents directory which contains all persistent data for all
instances.
Unfortunately our tests aren't entirely deterministic and rarely one
test would overlap with another. When this happened the setup code for
the next test would delete the data out from underneath the previous
one.
Before this fix we'd see frequent travis failures and I would see an
occasional local failure (1 out of ~5 runs). With this fix I've seen no
failures in 30 cycles.
* Remove stale references to DatabaseId
* Have Firestore take the DatabaseId directly
* Allow tests to default the database implicitly
* Have FSTSerializerBeta take DatabaseId by value
* Have FSTUserDataConverter take DatabaseId by value
* Make FIRFirestore.databaseID a const reference
* Make FSTFirestoreClient.databaseID a const reference
* Have FSTReferenceValue take DatabaseId by value
* Have DatabaseInfo take DatabaseId by value
* Have Serializer take DatabaseId by value
* Fix C++ ReferenceValue
* Take DatabaseId by value
* Reverse order to match Android
* Rename `reference` to `key`
* Fix a couple small issues I tripped over today.
1. Fix primeBackend so it uses an isolated FIRFirestore* instance. I ran into
an issue where tests that try to change .settings would fail if they were the
very first test run, since primeBackend had already configured the client and
so settings could no longer be changed.
2. Remove FIRFirestore.client and make api::Firestore.client() assert client is configured.
* 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.
* 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
* 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.
* Add an empty GoogleService-Info.plist to the Firestore project
* Add machinery to be able to use GoogleServices-Info.plist in integration tests.
* Refer to instructions if neither a plist nor testing cert is set up
* Convert between leveldb::Status and util::Status
* Use new filesystem routines in FSTLevelDB
Also rework -[FSTPersistence start] to return Status
* Remove unused leveldb::Status to NSError conversions
* Add GoogleTest as a dependency of Firestore_IntegrationTests_iOS
* Add a MakeStringView benchmark
Turns out this is worse than just creating a std::string:
BM_MakeString 29 ns 29 ns 189065849
BM_MakeStringView 59 ns 59 ns 93013367
* Convert database_id to take std::string
* Convert DatabaseInfo to take std::string
* Convert User to take std::string
* Convert Token to take std::string
* Convert MakeStringView([NSString stringWithFormat:]) to StringFormat
* Avoid direct use of generated umbrella headers
These:
* don't exist in static library builds
* have different names in multi-platform builds
* Only iOS targets depend upon Firebase/Core
Add option to allow the user to control where DocumentReference.getDocument() and CollectionReference.getDocuments() fetches from. By default, it fetches from the server (if possible) and falls back to the local cache. It's now possible to alternatively fetch from the local cache only, or to fetch from the server only (though in the server only case, latency compensation is still enabled).
* lint.sh now lints Objective-C++ too
* cpplint checks system-style includes that should be user-style
This prevents it from recognizing project sources as if they were C
system headers and then complaining that they're in the wrong place.
* cpplint checks #imports and #includes
* cpplint checks that C++ system headers aren't #imported
* cpplint checks for C system headers that could be C++ system headers
* cpplint checks that Objective-C sources include their headers
* add a new property `timestampsInSnapshotsEnabled` to `FirestoreSettings`, `false` by default;
* add a verbose warning message urging users to opt into the new behavior;
* set `timestampsInSnapshotsEnabled` to true in the integration tests to reduce the verbose console
spam during the test run and make sure the flag won't break anything once it's flipped.
* lazy replacing FST(Firebase)CredentialsProvider by (Firebase)CredentialsProvider
* lazy replacing FSTUser by User
* adding error-code parameter to TokenListener
* actually use const user& instead of pointer; also add an error util
* add HashUser and pass into the unordered_map
* use User in test
* use c++ CredentialsProvider and subclass in test
* fix unit test
* use explicit capture in lambda instead of capture all by reference
* cache currentUser explicitly when reset sync engineer test driver
* objc object should be captured by value in lambda
* replacing Auth/FSTUser by C++ auth implementation
* address changes
* replacing FSTGetTokenResult by C++ Token implementation
* address changes
* fix unintentional change in merging
* patch the change in objc Auth up-stream
* somehow, the lambda-version of set-user-change-listener does not work... fallback to block
* address changes
* fix another const& v.s. dispatch bug
* fix more const& v.s. dispatch bug zxu123 committed
* fix a bad sync line
* address changes
* address change
* address change
* fix upstream change from merge
* fix upstream changes
* Suggested fixes for cpp/port_auth (#846)
* Get rid of MockDatastore factory
This avoids the need to statically allocate (and leak) a credentials
provider
* Use absl::make_unique
std::make_unique technically does not exist until C++14.
* #include <utility> for std::move
* Use std::future for the initial user
* fix style
Basically a port of https://github.com/firebase/firebase-js-sdk/commit/a1e346ff93c6cbcc0a1b3b33f0fbc3a7b66e7e12 and https://github.com/firebase/firebase-js-sdk/commit/fce4168309f42aa038125f39818fbf654b65b05f
* Introduces a DelayedCallback helper class in FSTDispatchQueue to encapsulate delayed callback logic.
* Adds cancellation support.
* Updates the idle timer in FSTStream to use new cancellation support.
* Adds a FSTTimerId enum for identifying delayed operations on the queue and uses it to identify our existing backoff and idle timers.
* Added containsDelayedCallback: and runDelayedCallbacksUntil: methods to FSTDispatchQueue which can be used from tests to check for the presence of a callback or to schedule them to run early.
* Removes FSTTestDispatchQueue and changes idle tests to use new test methods.
* implement Firestore DatabaseInfo in C++
* temporary stash changes; blocking on the massive renaming of .m to .mm
* add database_info_test to project
* finish port DatabaseId and fix style, modular fixing DatabaseInfo
* port DatabaseInfo
* remove FSTDatabase{ID,Info} and their tests from project
* fix unit test
* use namespace alias
* use namespace alias, leftover
* address more changes
* refactoring to use raw pointer instead of value for property
* address changes
* remove self->
* fix style
* remove the name suffix Alloc
* fix a bug
* Move sources into firebase::firestore and internal namespaces
Combine support and core/util packages; this distinction wasn't really
paying its freight.
* Port autoid to C++
* Reimplement FSTUtil on top of firestore::CreateAutoId directly
* Migrate FSTUtil callers to directly use firestore::CreateAutoId
* Remove FSTUtil
This simplifies the import process back into google3 and allows us to add additional directories to the project without needing to update the project files for each directory we add. This shows up most clearly in the change to Firestore/Example/Firestore.xcodeproj/project.pbxproj: this no longer needs to list essentially every directory in the project as a header search path.
* Clang-format configuration for C++ files
* Add support C++-only sources to the podspec
* Podspec support for fully qualified imports
* xcodeproj changes for fully-qualified imports
* Use fully-qualified imports in Firestore sources
* Make all FIRLogger functions extern "C"
* Make FSTIntegrationTestCase Objective-C++
Keep external interface to FSTIntegrationTestCase Objective-C
* Add explicit dependency on Firebase/Community/Core from Tests
This fixes a linkage error on a missing _FIRSetLoggerLevel symbol