Commit Graph
460 Commits
Author SHA1 Message Date
Brian Chen 251a70f26a Make IN queries publicly available (#4174) 2019-10-29 14:13:02 -07:00
Brian Chen 441d7eda8b Change id to NSArray<id> for IN queries (#4182) 2019-10-28 22:22:37 -07:00
Gil fb441a0376 Build all sources with CMake (#4159)
* Fix field initialization order

* Reduce dependencies in objc_compatibility_apple_test

This makes it possible to build and test util without having to build
everything

* Add a lint check for CMake files

* Find XCTest, if available

* Fix CMakeLists.txt to include all sources

* 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-10-28 13:03:21 -07: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
Konstantin Varlamov 0f2a0bfeef Use C++ serializer for communicating with the backend (#4013)
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.
2019-10-18 17:58:14 -04:00
Gil cd460eca2d Rationalize input validation exceptions and assertion failures (#4107)
* Rationalize input validation exceptions and assertions

... under a single ThrowHandler concept. This makes it possible to set
an alternative ThrowHandler in our C# bindings that properly translates
input validation exceptions to the correct .NET exception types.

* Rename api/input_validation.h to util/exception.h

* Reimplement util/hard_assert.h in terms of util/exception.h
2019-10-18 12:58:45 -07:00
Konstantin Varlamov 893002541b Serializer: implement encoding and decoding of Target (#3932) 2019-10-03 19:05:05 -04:00
Gil 057d0dff1f Make FIRDocumentChange a closed enum (#3960) 2019-10-02 08:43:35 -07:00
Brian Chen bca8785e62 Move addSnapshotsInSyncListener to public (#3968) 2019-10-01 14:32:30 -07:00
Brian Chen 6495dca55c Move snapshotsInSync to public (#3942) 2019-09-30 16:36:51 -07:00
Gil 5356a25786 Better fix for typos in FIRDocumentSnapshot.h (#3923)
Actually fixes #3873.
2019-09-25 14:17:57 -04:00
Gil 2d161711ff Fix typos in FIRDocumentSnapshot.h (#3920)
Fixes #3873.
2019-09-24 21:32:03 -04:00
Konstantin Varlamov 9ced69b675 Make Serializer fully support converting FieldValues (#3659)
This involved support for reference values and taking server timestamps into account (by crashing, because they are not supposed to ever be serialized).

The biggest change is from making every function that decodes a `FieldValue` a member function (as well as any function called by those functions). That is because decoding a reference requires comparing database IDs, and the database ID of this Firestore instance is stored on the `Serializer`.
2019-09-24 18:43:19 -04: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 538cdfd10f Clean up Objective-C remnants (#3866)
* Remove references to removed classes

* Remove references to FSTSyncEngine

* Fix references to Objective-C names that are no longer valid.

* Remove forward declarations to classes that don't exist

* Remove FSTTypes.h

* Remove usages of headers that no longer apply

* Clean up header imports

* Remove traces of Objective-C from api/firestore.{h,mm}

* Strip NS_ASSUME_NONNULL directives that don't apply

* Remove FSTSyncEngine.h
2019-09-18 10:06:35 -07:00
wu-hui 0ba2d76302 Port local store to C++ 1/2 (#3833)
Creates `LocalStore` in C++ and make `FSTLocalStore` delegating all work to that.
2019-09-17 22:12:36 -04:00
Sebastian Schmidt 409905d535 Change the order of checks in applyRemoteEvent() (#3847) 2019-09-13 14:13:11 -07:00
Brian Chen f7028988b1 Split ListenerRegistration into QueryListenerRegistration (#3832) 2019-09-12 16:44:14 -07: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
rsgowman ae3310317c Allow overriding of the default failure handler (#3793) 2019-09-10 17:14:15 -04:00
wu-hui 1ce982de85 Port FSTSyncEngine to C++ SyncEngine 2/2 (#3741) 2019-09-05 18:40:58 -04:00
Sebastian Schmidt f0f0aeba20 Don't persist documents that we already have (#3650) 2019-09-05 15:36:29 -07:00
Gil f750f87f9f Add CMake support for FSTLocalSerializer (#3753)
* Add support for building Objective-C protos in CMake

* Add support for building FSTLocalSerializer to CMake

* Build ProtoSizer with CMake

* Build memory components with CMake

* Build LevelDB components with CMake
2019-09-05 09:10:15 -07:00
Gil d058af9556 Finish sizer interface (#3752)
* Use int64_t for CalculateSizeBytes

This avoids a bunch of nasty casting/checking in other parts of the code

* Use the Sizer for MutationBatches

* Don't double-count document key size.
2019-09-04 14:56:04 -07:00
wu-hui ffd7316a01 Port FSTSyncEngine to C++ SyncEngine 1/2 (#3726)
* Ported and delegated

* using util

* use shared_ptr by value

* reformat

* addressing comments #1

* addressing comments #2

* addressing comments #3
2019-09-04 15:15:31 -04:00
Gil 58cae6c573 Misc Objective-C cleanups (#3751)
* 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
2019-09-04 11:39:13 -07:00
Gil e374338b83 Fix removal of view references in FSTLocalStore (#3737) 2019-09-02 20:07:28 -07:00
Gil 3a2077f1e4 Fixes for the Codable API (#3734)
* Annotate Transaction and WriteBatch methods as discardable

These methods exist to allow chaining if that's useful but chaining
isn't expected or required.

Note that Objective-C methods in these types are implicitly
@discardableResult and don't need any extra help.

* No need to explicitly discard results

* Fix typos in FIRCollectionReference docs

* Add support for CollectionReference.addDocument(from:)
2019-09-02 16:40:21 -07:00
wu-hui c5b5a44603 Rename shutdown to terminate and publish it. (#3694)
* Rename shutdown to terminate and publish it.

* Addressing feedbacks
2019-08-27 11:51:01 -04:00
Gil 423cab7732 Add a Sizer abstraction to MemoryPersistence (#3692)
This breaks the link between MemoryPersistence-related classes and
FSTLocalSerializer, making it possible to use these in straight C++.
2019-08-27 08:27:44 -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 5cdff78f2b Migrate FSTView to C++ View (#3684)
* Add C++ ViewChange

* Migrate FSTViewChange to C++ ViewChange

* Add C++ View

* Migrate FSTView to C++ View
2019-08-26 19:39:54 -07:00
wu-hui 6bcf6ba58c publish waitForPendingWrites (#3690)
* publish waitForPendingWrites

* add change log

* move impl out of internal
2019-08-26 16:08:46 -04:00
wu-hui 7870c73b7c Port FSTFirestoreClient to C++ 2/2 (#3657)
* firestore_client + FSTFirestoreClient becomes delegate.

* fix comment

* addressing comment

* use new instead make_shared

* reformat

* Update references to firestore client

* Addressing comments#2

* addressing comments #3

* add std::move

* remove deleted header.

* fix cmake build error.
2019-08-26 15:48:18 -04:00
wu-hui 653744196f Port FSTFirestoreClient to C++ 1/2 (#3640)
* firestore_client + FSTFirestoreClient becomes delegate.

* fix comment

* addressing comment

* use new instead make_shared

* reformat

* Addressing comments#2

* addressing comments #3
2019-08-26 11:37:18 -04: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
wu-hui adb93131fa Fix misplaced waitForPendingWrites (#3654)
* Fix misplaced waitForPendingWrites

* reformat
2019-08-22 15:02:30 -04:00
Brian Chen c7777be93c Retrying transactions with backoff (#3599) 2019-08-21 11:12:09 -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
Konstantin Varlamov 450acf9c42 Remove no-longer-used FSTAsyncQueryListener (#3634) 2019-08-20 13:49:14 -04:00
Morgan Chen 42c963549d Document undocumented declarations (#3620) 2019-08-19 15:39:45 -07:00
Gil 6b36c0671a Migrate from NSData to nanopb::ByteString for resume tokens (#3592) 2019-08-19 12:22:56 -07:00
Gil e64663a907 Convert Filters to polymorphic value types (#3568) 2019-08-16 13:31:05 -07:00
Gil 7974497ebb Add assertions to TransformOperation cast constructors (#3589)
Also, make ArrayTransform::elements work more like the other platforms,
where you check type and cast, rather than having a magic method that
does both.
2019-08-16 13:13:52 -07:00
Marek Gilbert cd8619b817 Merge branch 'firestore-master' 2019-08-16 10:09:38 -07:00
Michael Lehenbauer 6555e1cc7c Provide a helpful error if FIROptions.projectID is missing. (#3610) 2019-08-16 07:43:13 -07:00
Marek Gilbert ffc455650d Merge branch 'master' into firestore-master 2019-08-16 07:25:07 -07:00