Commit Graph
157 Commits
Author SHA1 Message Date
Gil 38d9643a00 Disallow empty document fields (#4229)
Port of firebase/firebase-android-sdk#643.

Also make error messages align with Android's.
2019-11-04 17:03:10 -06:00
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 b1be1a9c70 Ensure that projectIDs are validated (#4073)
* Avoid priming the backend for emulator tests

* Validate that nil project ids are rejected
2019-10-17 10:03:01 -07:00
Gil 971445ce35 Add cross-platform support for creating Executors (#3897)
* 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.
2019-09-26 10:41:36 -07: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
wu-hui dff57b6048 Enable -Werror for Firestore XCode project (#3836) 2019-09-13 12:39:18 -07:00
wu-hui 1ce982de85 Port FSTSyncEngine to C++ SyncEngine 2/2 (#3741) 2019-09-05 18:40:58 -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 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
Gil 49de84aa5c Migrate FSTMutationBatch to C++ MutationBatch (#3673) 2019-08-25 17:40:31 -07: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
Marek Gilbert ffc455650d Merge branch 'master' into firestore-master 2019-08-16 07:25:07 -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
wu-hui 7b0159667e allow unlisten after shutdown (#3594) 2019-08-14 22:40:53 -04: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
Brian Chen e520b78a53 Fix flaky integration test (#3470) 2019-07-30 11:57:51 -07:00
Brian Chen b9113f500e Only retry transactions on non-permanent errors (#3443) 2019-07-27 09:46:42 -07:00
Brian Chen 9efd84392b Fix preconditions in transactions (#3429) 2019-07-25 14:12:29 -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 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
Brian Chen a2f0cf9678 Throw last failed attempt's error in failed transactions (#3287) 2019-07-09 11:34:55 -07:00
Sebastian Schmidt 6db6cc7909 Store the coerced base value in the BaseMutation (#3292) 2019-07-03 08:45:31 -07:00
Hui-Wu 13671fda27 Allow firestore api to work with Codable objects + ExplicitNull + Integration tests (#3261)
* Convinience api for codables

* Integration Tests

* ExplicitNull implementation
2019-06-28 15:07:52 -04: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
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 12b7397e4b Upgrade to Firestore Emulator 1.5.0 (#3171)
This includes fixes for:

  * All the field escaping tests
  * testCanWriteVeryLargeBatches
  * testWritesWithIndirectlyNestedArraysSucceed

All tests now pass. I've left isRunningAgainstEmulator in the source
even though there are now no callers.
2019-06-11 13:34:49 -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 c866936c7d Upgrade the emulator we use for integration testing to 1.4.6 (#3038)
* Bump to cloud-firestore-emulator 1.4.6
* Re-enable transform-related integration tests against the emulator
* Re-enable collection-group query integration tests
* Re-enable most transaction-related tests
2019-05-20 21:42:58 -07:00
Brian Chen 03130acf37 Change AsyncQueue to used shared_ptr instead of raw pointers (#3004) 2019-05-17 15:29:30 -07:00
Brian Chen afe63ccff5 Add clearPersistence() to Firestore client(#2993) 2019-05-17 11:29:20 -07:00
Brian Chen 6c6ef3b904 Throw error in subsequent function calls after the client is shutdown (#2978) 2019-05-09 17:07:05 -07:00
Gil 6fc90d34ef Fix sanitizer builds (#2940)
* Make GrpcConnection safe to use with thread sanitizer

One additional lock acquisition per connection attempt isn't going to
kill us.

* Make tests pass with tsan and ubsan
2019-05-07 09:16:03 -07:00
Gil 9c1035bfe3 Run Firestore integration tests against the emulator (#2936)
* Run Firestore integration tests against the emulator

* Ignore emulator-related files

* Add a script to run the Firestore emulator

* Blacklist all transformation-related tests
2019-05-03 18:15:33 -07:00
Gil 547ed27027 Add support for running Firestore integration tests against the emulator (#2922) 2019-05-03 07:55:57 -07:00
Gil 7a7eced747 Don't use using statements in Objective-C headers ... (#2827)
use namespace aliases instead.

This makes the Objective-C code much more like what it's going to end up
being like when translated to C++: headers will include classes declared
in a namespace relative to firebase::firestore so everything else will
be named relative to firebase::firestore.

Meanwhile the using statements in the headers were causing us to miss
adding using statements in source files which was moving us away from
where we wanted to be.
2019-04-12 17:03:26 -07:00
Michael Lehenbauer 754d5c07d4 Expose Collection Group queries. (#2786) 2019-04-09 20:50:58 -07:00
rsgowman 58e36e15cb Migrate FSTStringValue to FSTDelegateValue (#2719) 2019-04-08 16:16:04 -04:00
Gil 8ef6cf80be Fix use-after-free in DocumentReference::AddSnapshotListener (#2686) 2019-03-29 20:40:48 -07:00
Michael Lehenbauer 22cdb796be Fix a couple expected error messages in tests to match recent code changes. (#2685) 2019-03-29 20:00:33 -07:00
Gil ba332be794 Port FSTAsyncQueryListener to C++ (#2620)
* Test that shows a leak.

* Add EventListener to match Android.

* Use AsyncEventListener in FSTQueryListenerTests

* Remove FSTAsyncQueryListener

* Use EventListener throughout
2019-03-26 11:54:03 -07:00
Gil 9c95d61304 Update project and fix warnings (#2531)
* Update Firestore project to Xcode 10.1 defaults

* Fix NSUInteger in format strings warning

* Fix implicit conversion warning in FSTLevelDB

* Fix BOOL/bool mismatch

* Fix erroneous comparison

This failure shows up on 32-bit targets. I have no idea why this
succeeds on 64-bit targets.

* Fix incorrect type inference with explicit cast

clang is inferring the type of the key in these maps is `NSString *` and
then complaining that `FIRFieldValue *` doesn't match that type, despite
the underlying method taking `NSDictionary<id, id>`. Explicitly casting
to `id` prevents the warning.

* Remove reliance on representation in FSTFieldValue tests

On *some* platforms [NSNumber numberWithChar:1] ends up with a "c"
(signed char) objcType, but apparently on 32-bit platforms this ends up
as "i" (signed int). Rather than relying on this working properly just
test that [NSNumber numberWithBool:] does the right thing.

* Fix field_value_test on 32-bit targets

When sizeof(void*) is 4 the test failed :-(.

* Rephrase testWritesWithLargeNumbersFail in terms of fixed size types

The prior definition only worked on LP64. Switching to LLONG_MAX would
have also fixed this, but Firestore's data model is independent of C's
data model, so rewriting this in terms of fixed size types more closely
models what's actually an invalid value.

* Fix implicit retain self warnings
2019-03-12 15:58:52 -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