Commit Graph
121 Commits
Author SHA1 Message Date
Gil 3ea7197090 Port FSTQueryCacheTests to C++ (#4160)
* 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.
2019-11-02 09:09:25 -05:00
Konstantin Varlamov 8b23a3266d Remove Objective-C serializers and make local/ and remote/ (almost) fully C++ (#4151)
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.
2019-10-23 20:56:44 -04:00
Gil 6fd815a5ed Port FSTRemoteDocumentCacheTests to C++ (#4136) 2019-10-23 12:28:16 -07:00
Konstantin Varlamov 2c53bb9139 C++ migration: use C++ serializer for communicating with the local store (#4116)
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.
2019-10-22 21:52:55 -04:00
Gil 3f1fbe7e9a Migrate FSTPersistenceTestHelpers to C++ (#4122)
* 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
2019-10-21 20:12:46 -07:00
Gil 11de159e8e Migrate FSTRemoteEventTests to C++ (#3965)
* move (unchanged) into Firestore/core

* split out TestTargetMetadataProvider

... also rename to not start with "test".

* rewrite in C++
2019-10-04 11:55:20 -07:00
Sebastian Schmidt 41c411e8f4 Add QueryData.with() helpers (#3991) 2019-10-03 14:52:12 -07: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
Sebastian Schmidt f0f0aeba20 Don't persist documents that we already have (#3650) 2019-09-05 15:36:29 -07:00
Gil e374338b83 Fix removal of view references in FSTLocalStore (#3737) 2019-09-02 20:07:28 -07:00
Gil aa326a47ce Migrate FSTLRUGarbageCollector to C++ LruGarbageCollector (#3685)
* 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
2019-08-26 21:56:15 -07:00
Gil 49de84aa5c Migrate FSTMutationBatch to C++ MutationBatch (#3673) 2019-08-25 17:40:31 -07:00
Gil 1971af49c9 Partially migrate stream tokens from NSData to ByteString (#3643)
* 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
2019-08-22 15:18:11 -07:00
Gil 2e5e8b5676 Migrate FSTQueryData to C++ QueryData (#3595)
* Migrate FSTQueryData to C++ QueryData

* Remove FSTQueryData
2019-08-20 14:56:32 -07:00
wu-hui ea3b589ac0 Port waitForPendingWrites (#3619)
* port waitForPendingWrites

* addressing comments #1

* remove commented line

* another change to disable network
2019-08-20 16:18:02 -04:00
Gil 6b36c0671a Migrate from NSData to nanopb::ByteString for resume tokens (#3592) 2019-08-19 12:22:56 -07:00
Gil aefd4323a2 Remove Objective-C immutable sets and maps (#3590)
* Remove Firestore/third_party/Immutable

* Update podspec and sync_project

* Project updates
2019-08-19 09:09:20 -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
Gil 0c23f38397 Migrate Objective-C document types to C++ (#3531)
* Rewrite Document-related classes as a polymorphic value type

* Pass ObjectValue without rvalue references

* Rename HasLocalMutations

* Port C++ users to new Documents

* Port FSTDocumentTests to C++

* Port FSTDocumentSetTests to C++

* Migrate DocumentMap and DocumentSet to C++ Document

* Migrate test helpers

* Delete FSTDocumentSetTests

* Delete FSTDocumentTests

* Mechanical changes to use C++ Document

* Updates to the project file

* Nontrivial test updates

* Remove FSTTestDeletedDoc

* Remove FSTTestUnknownDoc

* Remove FSTDocument

* Convert usage of FSTDocument to C++ Document

* Fix Serializer usage of Documents
2019-08-13 13:59:00 -07:00
Gil 13a1b33913 Migrate from FSTQuery to C++ Query (#3484) 2019-08-02 11:35:33 -07:00
Gil 1e45a36b62 Migrate canonical ID and Document comparators to C++ (#3479)
* Migrate FSTQuery canonicalID to C++ Query

* Migrate query's DocumentComparator to C++ Query

* Expose DocumentSet::comparator
2019-08-01 15:00:50 -07:00
Konstantin Varlamov 76b8da658e Rename FirestoreErrorCode to just Error (#3460) 2019-07-30 21:44:56 -04:00
Hui-Wu 99ffc721e4 Port FSTLocalViewChanges to C++ (#3435)
* added c++ implementation

* Looks like it's working.

* trying to reformat

* Reformat with proper clang-format version

* Addressing comments
2019-07-25 21:57:22 -04:00
Hui-Wu 2bb8ec5b05 Port FSTLocalWriteResult to c++ (#3389)
* unique_ptr test failure

* Hopefully working?

* address comment and remove OC class

* remove compile commands and reformat

* reformat

* no using in header
2019-07-21 22:12:02 -04:00
Gil cf682c69cc Complete migration to C++ Filters in FSTQuery (#3349)
* Use C++ Filters in FSTQuery without changing interface

* Remove FSTQuery initWithPath

* sync_project.rb generated changes

* Implement Filter equality

* Consistently use testutil:: helpers unqualified

* Use C++ Filters in FSTQuery
2019-07-15 12:47:38 -07:00
Gil ffdc328732 Migrate FSTDocumentState to C++ DocumentState (#3225) 2019-06-20 09:39:19 -07:00
Gil 10752cd68c Finish migration of FSTFieldValue to C++ FieldValue (#3178)
* Split transform_operations

* Revert "Make ServerTimestamp use FSTFieldValue for previous value"

* Finish FieldValue migration

* Delete FSTFieldValue
2019-06-18 16:21:17 -07:00
Gil 7f1050ae27 Use C++ Timestamp internally instead of FIRTimestamp (#3156)
This is yet another preparatory step to migrating FIRTimetsampValue to
C++.
2019-06-11 10:56:28 -07:00
Gil 8770828dd8 Refactor usages of DatabaseId to avoid raw pointers (#3041)
* 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`
2019-05-21 20:28:51 -07:00
Gil c2a3d04e6d Port FSTDocumentSet to C++ (#2608)
* Replace FSTDocumentSet's guts with immutable::SortedSet.

* Port FSTDocumentSet to C++ DocumentSet.

* Replace implementation of FSTDocumentSet with C++ DocumentSet

* Update all usages of FSTDocumentSet

* Remove FSTDocumentSet

* Add Objective-C++ guard

* Use absl::c_equal instead of hand-rolling it.

* Split SortedContainer out of SortedMapBase

... and use it

* Fix NSNotFound -> npos

* Remove = default constructors that aren't true.

These are implicitly deleted because DocumentSet is a member and isn't
default constructible.

* Fix usage of FSTQuery.limit
2019-03-25 11:04:21 -07:00
Gil e4dcc96e52 Eliminate Objective-C BOOL in Firestore/core (#2574)
* Add objc::EqualTo and objc::Hash

These make it possible to use std::unordered_map with Objective-C object
keys.

* Use std::unordered_map in MemoryQueryCache

* Fix objective-C library detection

This ensures that .mm files are compiled with -fobjc-arc (among other
things).

* Remove BOOL in FSTDocument to eliminate static_cast<bool>
2019-03-18 17:28:46 -07:00
Michael Lehenbauer bd0b8e9449 Collection Group Query Internals (#2378)
Includes the new index and all internals for collection group queries, but the public API will not be exposed until backend support is ready.
2019-03-08 13:37:00 -08:00
Sebastian Schmidt 657f53a9b8 Adding FieldValue.increment() (#2075) 2019-03-06 14:51:30 -08:00
Michael Lehenbauer 61a7fc1571 Improved query performance in the face of subcollections. (#2471)
Ports an optimization from Android where we skip parsing documents that are in
subcollections beneath the collection we're querying over.
2019-03-05 13:21:37 -08: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
Greg Soltis 388f267d6e Remove FSTMutationQueue (#2319)
* Remove FSTMutationQueue
2019-01-29 16:01:59 -08:00
Konstantin Varlamov 8626e31feb C++ migration: port FSTRemoteEvent (#2320) 2019-01-29 18:55:25 -05:00
Greg Soltis d8e3704360 Add MutationQueue interface (#2317)
* Implement mutation queue interface and port tests
2019-01-28 10:21:20 -08:00
Konstantin Varlamov 9789c614ea C++ migration: port FSTWatchChangeAggregator and FSTTargetState (#2313) 2019-01-27 16:45:15 -05:00
Greg Soltis a98e1ddb9c Implement FSTLevelDBMutationQueue in C++ (#2310)
* Port leveldb mutation queue to C++
2019-01-25 13:27:58 -08:00
Konstantin Varlamov faad116a5b C++ migration: eliminate FSTBoxedTargetId (#2301) 2019-01-24 17:01:31 -05:00
Konstantin Varlamov acb222026a C++ migration: port FSTWatchChange. (#2300) 2019-01-23 17:26:49 -05:00
Konstantin Varlamov a52abec999 Stop persisting last acknowledged batch ID (#2243)
After #2029, acknowledged batches are always immediately removed, so persisting the last acknowledged batch ID is no longer necessary.
2019-01-11 12:43:07 -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
Greg Soltis 900ca3b83d Implement QueryCache interface and port QueryCache tests (#2209)
* Implement QueryCache interface and port tests

* Port production usages of QueryCache (#2211)

* Remove FSTQueryCache and implementations

* Switch size() to size_t
2018-12-21 22:08:34 -08:00
Greg Soltis 466880b094 Continue work on ReferenceSet (#2213)
* Migrate FSTDocumentReference to C++

* Change SortedSet template parameter ordering

Makes it easier to specify a comparator without specifying what the
empty member of the underlying map is.

* Migrate MemoryMutationQueue to C++ references by key

* migrate.py

* CMake

* Finish porting ReferenceSet

* Swap reference set implementation

* Port MemoryQueryCache to use ported ReferenceSet

* Port FSTReferenceSetTest

* Port usage for limbo document refs

* Port LRU and LocalStore usages

* Remove FSTReferenceSet and FSTDocumentReference

* Style

* Add newline
2018-12-21 21:03:13 -08:00
Gil 6af931d4e8 Migrate Firestore to the v1 protocol (#2200)
* Use python executable directly

  * python2 is not guaranteed to exist
  * scripts aren't directly executable on Windows

* Add Firestore v1 protos

* Point cmake at Firestore v1 protos

* Regenerate protobuf-related sources

* Make local protos refer to v1 protos

* fixup! Regenerate protobuf-related sources

* Remove v1beta1 protos

* s/v1beta1/v1/g in source.

* s/v1beta1/v1/ in the Xcode project

* Remove stale bug comments.

This was fixed by adding an explicit FieldPath API rather than exposing
escaping to the end user.
2018-12-21 11:28:48 -08:00