Commit Graph
107 Commits
Author SHA1 Message Date
Gil d9b7a33f0c Use forward declarations instead of IWYU (#4868)
* Remove rarely used template argumnets from SortedMap/SortedSet

* Remove unused STATUS_CHECK_OK

* Rename QuerySnapshot::Listener to QuerySnapshotListener

This makes the type something that can be forward declared.

* Rename DocumentSnapshot::Listener to DocumentSnapshotListener

This makes the type something that can be forward declared.

* Rename ViewSnapshot::Listener to ViewSnapshotListener

This makes the type something that can be forward declared.

* Put most QueryListener implementation in .cc

* Actually use sync_engine_callback.h

* Add forward declaration headers for api, core, and model

These centralize forward declarations, including declarations for some
hard-to-forward-declare types.

* Move includes of hard_assert.h out of other headers

* Make testutil definitions out of line

* Move definitions out-of-line

* Move DocumentKey definitions out-of-line

* Move definitions out-of-line

* Shorten unnecessarily long namespace usages

* Use default destructors where possible

* Delete unused MutationBatch::kUnknown constant

* Use forward declarations instead of IWYU

* Misc fixups from Linux/GCC 9.2.1

* Fix testutil under VS 2017

Forward declarations of functions local to a function body end up
generating unresolved externals. Reduce most of these back to just
calling FieldValue::FromX methods.
2020-02-15 14:34:38 -08:00
wu-hui 14e28121e2 Release LimitToLast (#4616)
* [1/4] Split Query and Target, and make LocalStore/RemoteStore work with Target. (#4413)

* [2/4]LimitToLast: Make SyncEngine work with Target (#4491)

* [3/4] Implement LimitToLast (#4505)
2020-01-08 09:04:28 -08:00
wu-hui 2a8d069b77 Run integration tests from CMake on mac (#4276) 2019-11-19 13:40:43 -05:00
Brian Chen 0170957544 Allow querying for arrays in IN queries (#4285) 2019-11-12 13:07:58 -08:00
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
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -04:00
wu-hui dff57b6048 Enable -Werror for Firestore XCode project (#3836) 2019-09-13 12:39:18 -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
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 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
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
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 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 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 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
Michael Lehenbauer 754d5c07d4 Expose Collection Group queries. (#2786) 2019-04-09 20:50:58 -07: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
Sebastian Schmidt 657f53a9b8 Adding FieldValue.increment() (#2075) 2019-03-06 14:51:30 -08:00
rsgowman ca38562d3f Fix build for non-clang compilers (#2391) 2019-03-01 13:51:59 -05:00
rsgowman 0f32878009 Forbid queries endAt an uncommitted server timestamp. (#2382)
Without this, it still fails, but:
a) not until serializing the query, and
b) the error is an internal error, and
c) the error message is quite cryptic and has nothing to do with the problem.

Port of https://github.com/firebase/firebase-android-sdk/pull/138
2019-02-13 12:12:42 -05:00
Michael Lehenbauer a43709f18e Port flaky test fix from web. (#2332)
Port flaky test fix from web.

Port of https://github.com/firebase/firebase-js-sdk/pull/1511
2019-02-01 15:02:12 -08:00
Gil 2ac7c2f2ea Verify large write batches support (#2321)
* Reorder tests to match Android
* Add missing NS_ASSUME_NONNULL_BEGIN
* Add missing [self awaitExpectations]
* Port can write very large batches from Android
2019-01-28 17:21:49 -08:00
Michael Lehenbauer 5c67653de3 Change timestampsInSnapshots default to true and deprecate the setting. (#2251) 2019-01-11 13:47:13 -08: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
zxu 2b30c54ed3 fix a typo in integration test (#2131)
* fix a typo in integration test

* relax else condition to catch all abnormal cases
2018-11-29 14:02:44 -05:00
Konstantin Varlamov e0d797515c C++: eliminate FSTDispatchQueue and replace it with AsyncQueue (#2062)
* replace all references to `FSTDispatchQueue` and `FSTTimerID` with their C++ equivalents;
* remove `FSTDispatchQueue` class and related tests;
* in method argument names, replace `workerDispatchQueue` with just `workerQueue`, more similar to other platforms;
* move `Executor` and derived classes out of `internal` namespace.
2018-11-18 17:49:32 -05:00
Sebastian Schmidt 5bc4cc55a6 Remove Held Write Acks (#2029)
* Drop acknowledged mutations in schema migration (#1818)

Drop acknowledged mutations in schema migration as part of removing held write acks.

Port of firebase/firebase-js-sdk#1149

* Change removeMutationBatch to remove a single batch (#1955)

* Update Firestore Generated Protos

*  Adding UnknownDocument and hasCommittedMutations (#1971)

* Removing held write batch handling from LocalStore (#1997)

* View changes for held write acks (#2004)

* Held Write Acks Unit Test Fixes (#2008)

* Held Write Ack Removal Spec Tests (#2018)

* Fix integration test
2018-11-01 09:44:30 -07:00
zxu b86911573f Clean up test. The issue has already been fixed and we are now running integration test with actual server instead of hexa. (#2007) 2018-10-25 17:10:44 -04:00
Sebastian Schmidt 08dede03ba Don't drop empty object during merge (#1851) 2018-09-19 14:43:08 -07:00
Michael Lehenbauer 3827391c46 Offline get() improvements. (#1783)
[Port of https://github.com/firebase/firebase-js-sdk/pull/1197]

1. Changed MAX_WATCH_STREAM_FAILURES to 1 per conversation with @wilhuff and
   @jdimond.
2. Fixed a "race" where when a get() triggered a watch stream error, we'd
   restart the stream, then get() would remove its listener, and so we had no
   listener left once the watch stream was "opened". Without a listen to send
   we'd be stuck in Offline state (even though we should be Unknown whenever
   we have no listens to send), resulting in the next get() returning data
   from cache without even attempting to reach the backend.
2018-09-06 07:59:51 -07:00
Michael Lehenbauer b88f95c44f Reformat using 'clang-format version 7.0.0 (tags/google/stable/2018-04-24)' (#1681)
This is the version of clang-format that travis is currently using.
2018-08-13 14:18:02 -07:00