Commit Graph
196 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
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
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
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -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
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 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
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 adb93131fa Fix misplaced waitForPendingWrites (#3654)
* Fix misplaced waitForPendingWrites

* reformat
2019-08-22 15:02:30 -04: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
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
Gil 22b9c9006b Convert TransformOperations to polymorphic value types (#3567)
* Rename transform_operation{s,}

* Convert TransformOperation to a polymorphic value class

* fixup! Convert TransformOperation to a polymorphic value class

* Remove ServerTimestampTransform::Get
2019-08-16 07:23:57 -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 92cd10913f A grab bag of misc fixes (#3526)
* Remove last traces of FSTObjectValue

* Fix typos

* Add ToString to SnapshotVersion

* Add support for hashing enums and optionals
2019-08-07 21:28:50 -07: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
Brian Chen 86b09fa469 Add IN and ARRAY_CONTAINS_ANY (not publicly exposed) (#3492) 2019-08-05 11:47:06 -07:00
Gil 13a1b33913 Migrate from FSTQuery to C++ Query (#3484) 2019-08-02 11:35:33 -07:00
Gil 2f22dce569 Reimplement C++ Query with AppendOnlyList (#3483)
* Reimplement C++ Query with AppendOnlyList

* Fix missing assignment to last_document (!!!)

* Refer to filters as std::shared_ptr<const Filter>
2019-08-02 09:14:10 -07:00
Gil bef89668f0 Migrate FSTBound to C++ Bound (#3478)
* Port FSTBound to C++ Bound

* Add limit and Bound to Query

* Migrate FSTBound to C++ Bound, also limits
2019-08-01 12:58:53 -07:00
Gil 561325300b Port FSTSortOrder to C++ OrderBy (#3468)
* Port FSTSortOrder to C++ OrderBy

* Finish port of C++ Direction from Android

* Reimplement FSTSortOrder with C++ OrderBy

* Migrate FSTSortOrder to C++ OrderBy

* Remove FSTSortOrder

* Compare OrderBy equality in C++ Query
2019-07-31 15:39:38 -07:00
Brian Chen b9113f500e Only retry transactions on non-permanent errors (#3443) 2019-07-27 09:46:42 -07:00
Konstantin Varlamov a294e8c112 Remove extraneous imports (#3402)
Remove several imports that appear to be unused.
2019-07-21 17:16:04 -04:00
Gil ec3557601b Fix FIRDocumentChange returning incorrect values for not found (#3361)
Fixes #3298.
2019-07-15 18:00:18 -07:00
Gil 3b496318f4 Implement collection groups in C++ Query (#3327)
* Add a test that verifies canonical IDs don't change

* Remove Query::AtPath

This has no parallel in Typescript or Java implementations.

* Add util::Equals

... for comparing pointers by the thing to which they point.

* Use std::shared_ptr<const std::string> for collection group IDs

* Reorder/Cleanup C++ Query to match Android

* Add collection group to C++ Query
2019-07-11 15:59:35 -07: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
Konstantin Varlamov b645037a2e Fix small compilation and linter issues (#3222)
* remove C++11 library feature from `Timestamp` (which is supposed to be "portable");
* fix return type mismatch (`bool` vs `BOOL`);
* removed unused `using` declaration;
* fix typo in function name.
2019-06-19 20:13:27 -04:00
Gil 5a0914df1e Remove NSLog call in FIRDocumentSnapshot (#3213) 2019-06-19 13:10:51 -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 64d8a40a70 Migrate FSTReferenceValue to FSTDelegateValue (#3177)
* Add FieldValue::Reference

* Migrate FSTReferenceValue to FSTDelegateValue

* Build Objective-C components with CMake

Build only the things required for FSTFieldValue
2019-06-14 07:14:18 -07:00
Gil de7eb4f2e0 Migrate FSTServerTimestampValue to FSTDelegateValue (#3174)
* Migrate FSTServerTimetsampValue to FSTDelegateValue

* Make ServerTimestamp use FSTFieldValue for previous value

This makes it possible integrate the FSTServerTimestampValue changes
earlier.
2019-06-13 22:07:45 -07:00
Gil 34fcd5af6b Migrate FSTTimestampValue to FSTDelegateValue (#3170) 2019-06-11 13:41:53 -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 df06ad9a5c Clean up GeoPoint port to C++ (#3153)
... based on things learned porting Timestamps.

There's no good way to include conversions equivalent to toGeoPoint in
FIRTimestamp, so pull out separate conversion functions that match other
similar things.
2019-06-09 21:19:14 -07:00
Gil 04d1d41a16 Migrate FSTBlobValue to FSTDelegateValue (#3130)
* Rename nanopb::String to nanopb::ByteString

... and flesh it out.

* Remove const pb_bytes_array* constructor

* Use std:: prefixes

* Pull forward CopyVector

* Simplify nanopb::Reader/Writer construction

* Reuse ByteString construction in serializer

* Add nanopb_testing.h

* Make QueryData.resume_token a ByteString

* Use ByteString as FieldValue::blob_value

* Migrate FSTBlobValue to FSTDelegateValue

* Rework the ByteString API

  * Make data(), begin(), and end() never return nullptr
  * Make copies of pb_bytes_array_t* more obvious (also avoids ambiguity
    with the private constructor).

* Remove constructors that duplicate absl::string_view

* Make ByteString::Copy just a constructor

* Remove EncodeBytes/DecodeBytes

These duplicate ByteString constructors

* Overhaul ByteString and users

  * Remove most conversions from ByteString
  * Put remaining conversions in nanopb_util as free functions
  * Make ByteStringWriter accumulate in a pb_bytes_array_t*
  * Have ProtobufSerialize use ByteStringWriter

* Avoid reserving/writing if we're not asked to append data

* Ensure ByteStringWriter initializes/frees

* Make copies explicit

* Make Reserve match std::vector::reserve

* Add comments, assertions, and tests
2019-06-07 11:29:30 -07:00
Brian Chen 840ab65a69 Expose clearPersistence() publicly (#3026) 2019-06-05 16:25:09 -07:00
Gil 220589d9bc Port FIRCollectionReference to C++ (#3126)
Also fix up DocumentReference to use it.
2019-06-04 18:10:17 -07:00
Gil 9703caec5c Fix -[FIRGeoPoint compare:] analysis warning (#3121) 2019-05-31 17:49:04 -07:00
Gil dd94ab677f Change limit to an int32 to match the backend (#3120) 2019-05-31 14:10:02 -07:00
Gil 8428d4a8e2 Migrate null, numbers, and GeoPoints to FSTDelegateValue (#3044)
* Migrate FSTNullValue to FSTDelegateValue
* Migrate FSTIntegerValue to FSTDelegateValue
* Migrate FSTDoubleValue to FSTDelegateValue
* Migrate FSTGeoPointValue to FSTDelegateValue
2019-05-26 10:02:21 -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
Brian Chen afe63ccff5 Add clearPersistence() to Firestore client(#2993) 2019-05-17 11:29:20 -07:00
Brian Chen 570f4465de Use shared_ptr for AsyncQueue and Executor (#2996) 2019-05-15 09:55:18 -07:00