* Move FSTQueryCacheTests files to Firestore/core
* Rewrite QueryCache tests in C++
* Fix test flake in local store tests
This doesn't affect production because we always set the additional
references pointer there, but it's technically optional and some tests
don't do this.
There are more sources that can be `.cc` now (e.g., in API); these are left for a follow-up PR.
The dependency on Objective-C proto library cannot be removed just yet due to current lack of pretty-printing support for Nanopb.
After this PR is merged, the Objective-C serializers can be completely removed from the project. Also, this PR changes the `Message` class quite a bit; it's probably in its final form now.
I did some performance testing locally and came to the conclusion that replacing Objective-C serializers with their C++ versions brings no performance downgrade; actually, there seems to be a very slight improvement. I tested writing large batches and reading large collections:
* both are network-dominated; wall time is about twice longer than CPU time;
* serialization represents a pretty small percentage of the total CPU time;
* for writing, C++ serialization is a little more efficient, taking ~6% of total CPU time, compared to ~8% in the Objective-C version. I've seen similar results for reading.
All integration tests pass, under Address Sanitizer as well.
* Move FSTPersistenceHelpers to core/test/.../local
* Rewrite persistence_testing in C++
* Migrate from FSTPersistenceTestHelpers to C++ persistence_testing
* Rename .mm to .cc where possible in IndexManager tests
* Remove Objective-C gunk from index_manager_test.h
Replace all uses of `FSTSerializerBeta` in `remote_objc_bridge.{h,mm}` with the C++ `Serializer`. Also, make most of `remote/` sources pure C++ and remove no-longer-used methods in `FSTSerializerBeta`. All integration tests pass, under Address Sanitizer as well.
Unfortunately, pretty-printing is still delegated to Objective-C, so that `remote_objc_bridge.mm` still has to be an Objective-C++ source (and which prevents inlining `remote_objc_bridge` into the streams).
#no-changelog Will add a changelog entry when local serializer is ported, too.
* 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
* Clean up references to Firestore.pbrpc
We're no longer using Objective-C gRPC services and this is no longer generated.
* Remove no longer existing entries from xcgmock
* Add ReferenceDelegate
* Remove Objective-C crutches from model/types.h and query_cache.h
* Add C++ LruGarbageCollector
* Add delegate bridges for LruDelegate and ReferenceDelegate
* Migrate from FSTLRUGarbageCollector to C++ LruGarbageCollector
* Convert stream tokens from NSData to ByteString
Note that this persists in using protobuf's conflation of empty and null
strings.
* Rename remote_event.mm to .cc
* Tidy up mutation_test.cc ahead of filling it out
* Move FSTUserDataConverter tests out of FSTMutationTests
* Add operator<< for Document
The compiler won't apply the one for MaybeDocument.
* Port FSTMutationTests to C++
* Delete FSTMutationTests
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.
* Rename transform_operation{s,}
* Convert TransformOperation to a polymorphic value class
* fixup! Convert TransformOperation to a polymorphic value class
* Remove ServerTimestampTransform::Get
* Finish porting Precondition to C++.
* Finish port of FieldTransform to C++
* Add ToString to all TransformOperations
* Rename Precondition::IsNone to is_none to match other is_type helpers
* Finish port of SnapshotVersion to C++
* Add is_type accessors to FieldValue
* Add nanopb::MakeStringView(const pb_bytes_array_t*)
* Remove DummyOperation from transform_operations_test