Commit Graph
28 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
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -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
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
Konstantin Varlamov a294e8c112 Remove extraneous imports (#3402)
Remove several imports that appear to be unused.
2019-07-21 17:16:04 -04: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 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
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 547ed27027 Add support for running Firestore integration tests against the emulator (#2922) 2019-05-03 07:55:57 -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
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
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
Sebastian Schmidt d13a51abac Allowing field deletes using merge fields (#1389) 2018-06-07 13:57:01 -07:00
Sebastian Schmidt 542d81ac68 Adding mergeFields support (#1141) 2018-05-02 11:10:19 -07:00
Gil 5368c9e22f Replace the SetOptions object with a simple boolean. (#1098)
Instead of calling

  `setData(["a": "b"], options: SetOptions.merge())`

call

  `setData(["a": "b"], merge: true)`
2018-04-15 13:06:06 -07:00
Gil 33b12f6c70 Replace DocumentListenOptions with a simple boolean. (#1099)
* Replace `DocumentListenOptions` with a simple boolean.

Instead of calling

  `addSnapshotListener(options: DocumentListenOptions.includeMetadataChanges(true))`

call

  `addSnapshotListener(includeMetadataChanges:true)`

* Style
2018-04-14 17:19:06 -07:00
Konstantin Varlamov a17740e914 Add a flag to control whether DocumentSnapshots return Dates or Timestamps for timestamp fields (#831)
* add a new property `timestampsInSnapshotsEnabled` to `FirestoreSettings`, `false` by default;
* add a verbose warning message urging users to opt into the new behavior;
* set `timestampsInSnapshotsEnabled` to true in the integration tests to reduce the verbose console
spam during the test run and make sure the flag won't break anything once it's flipped.
2018-03-30 14:50:15 -04:00
Michael Lehenbauer 81ee594e32 DispatchQueue delayed callback improvements + testing (#784)
Basically a port of https://github.com/firebase/firebase-js-sdk/commit/a1e346ff93c6cbcc0a1b3b33f0fbc3a7b66e7e12 and https://github.com/firebase/firebase-js-sdk/commit/fce4168309f42aa038125f39818fbf654b65b05f

* Introduces a DelayedCallback helper class in FSTDispatchQueue to encapsulate delayed callback logic.
* Adds cancellation support.
* Updates the idle timer in FSTStream to use new cancellation support.
* Adds a FSTTimerId enum for identifying delayed operations on the queue and uses it to identify our existing backoff and idle timers.
* Added containsDelayedCallback: and runDelayedCallbacksUntil: methods to FSTDispatchQueue which can be used from tests to check for the presence of a callback or to schedule them to run early.
* Removes FSTTestDispatchQueue and changes idle tests to use new test methods.
2018-02-15 16:17:44 -08:00
Gil 729b8d176c Move all Firestore Objective-C to Objective-C++ (#734)
* Move all Firestore files to Objective-C++
* Update project file references
* Don't use module imports from Objective-C++
* Use extern "C" for C-accessible globals
* Work around more stringent type checking in Objective-C++
  * NSMutableDictionary ivars aren't implicitly casted to NSDictionary
  * FSTMaybeDocument callback can't be passed a function that accepts
    FSTDocument
  * NSComparisonResult can't be multiplied by -1 without casting
* Add a #include <inttypes.h> where needed
* Avoid using C++ keywords as variables
* Remove #if __cplusplus guards
2018-01-31 11:23:55 -08:00