Commit Graph
53 Commits
Author SHA1 Message Date
Nick Cooke ec8ca54b3e [Infra] Use full paths when importing public Core header (#13288) 2024-07-16 14:04:48 -04:00
cherylEnkidu 3de44b7ab7 Move Timestamp class from Firestore to Firebase Core (#13221) 2024-07-12 16:19:35 -04:00
cherylEnkiduandNick Cooke 065a5bbc74 Public Auto Persistent Index Creation API (#11757)
Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
2023-09-05 17:49:43 -04:00
cherylEnkidu c39ef8172b Add option to allow SDK create cache indexes automatically to improve query execution locally (#11596) 2023-08-29 11:26:19 -04:00
Tom Andersen f2194c8a3c Allow initializing FIRLocalCacheSettings with unlimited size. (#11405)
* Allow initializing FIRLocalCacheSettings with unlimited size.

* Add changelog.

* Add test

* Fix bug

* Add import

* Add import

* Exercise db with CacheSizeUnlimited

* Fix
2023-06-07 19:53:52 -04:00
wu-hui 7c8becdbba New Cache Config API (#11057) 2023-04-13 20:52:14 -04:00
Tom Andersen 68628ef4e3 Implement MultiDB Support and Tests (#10465) 2022-11-24 10:52:38 -05:00
Nick Cooke a09083f9d0 [v9] Reorganize FirebaseCore* modules (#9482)
* [skip ci] [will revert] Add debug printing to `pod_lib_lint.rb`

* Reorganize FirebaseCore libraries for SPM and CP

* [skip ci] Revert "[skip ci] [will revert] Add debug printing to `pod_lib_lint.rb`"

This reverts commit 2a837e39708c21b0a324743ab226bd6c01047de7.

* Review and fix CI

* Remove `heartbeat_logging.yml` and add `core_internal.yml`

* Remove trailing whitespace

* Fix more whitespace 😞

* Fix `core_internal.yml` scheme name

* Update `check_imports.swift` and TODO

* Review

* Add FirebaseCoreInternal pod to Firestore example's Podfile

* [skip ci] Review - remove TODOs

* [skip ci] Remove duplicate `XCTest` import
2022-03-23 06:08:14 -07:00
Paul Beusterien 6361347a22 Podspecs for CoreInternal and AppCheckInterop (#9300) 2022-03-23 06:08:03 -07:00
Paul Beusterien 4f793064da Set up Core Internal for SPM (#9298) 2022-03-23 06:07:17 -07:00
Denver Coneybeare 04b7555228 Get rid of util and testutil namespace aliases (#8917) 2021-11-02 22:31:45 -04:00
Denver Coneybeare 58c7566706 Fix a Firestore transaction crash if getDocument was called after terminateWithCompletion (#8760) 2021-10-08 10:31:43 -04:00
Konstantin Varlamov f243335a25 Don't define a util namespace alias in the global namespace. (#8527)
This would conflict with any definition of a `util` namespace imported from a header. While this applies to other aliases as well, `util` is the one most likely to clash and the one that has actually caused problems.

#no-changelog
2021-09-24 09:11:41 -06:00
Ehsan d191d0e1dd Do not consider MutableDocument's state for DocumentSnapshot comparison (#8647)
* `operator==` (isEqual) behavior for DocumentSnapshot.

* Do not consider MutableDocument's state for DocumentSnapshot comparison.

* Address comments.

* Update changelog.

* Don't compare the key twice.
2021-09-21 15:06:17 -05:00
Paul Beusterien b64e0fc623 Fix Firestore test build on Xcode 13 (#8575) 2021-08-25 09:03:19 -07:00
Konstantin Varlamov f1294cee91 Fix a crash that happens when Firestore is being terminated when the last shared pointer to it is in a listener (#7421)
If a user calls terminate and immediately disposes their reference to Firestore, it's possible that while termination is in process, the last remaining reference (more precisely, shared pointer) to Firestore is in a listener. When that listener is destroyed as part of the termination, it leads to `api::Firestore` being destroyed. Importantly, termination happens on the worker queue. The destructor of `api::Firestore` calls `Dispose` which presumes it's not called from the worker queue and tries to enqueue work, leading to a failing assertion and a crash.

The solution is simply to remove the sequential order checks when the queue enters/is in restricted mode. There is a legitimate case where the Firestore destructor can run on the worker queue, as the original issue shows. The complexity of #7412 also indicates that a simpler solution is preferable.

Fixes #6909.
2021-02-02 19:05:45 -05:00
Denver Coneybeare 69c3e4b9e5 Add an integration test for callbacks on the main thread (#6054) 2020-07-16 15:06:22 -04:00
Denver Coneybeare ffe23884da Add #include for config.h to get the value for HAVE_LIBDISPATCH (#6041) 2020-07-14 15:38:18 -04:00
Gil 59c8c95501 Have ListenerRegistration::Remove block until callbacks are complete (#5961)
* Add the ability to await a single expectation

* Await individual expectations in test helpers

This prevents tests from accidentally awaiting unrelated expectations
when using the helpers.

* Fix tests that implicitly relied on test helpers to await all

* Add a test that verifies ListenerRegistration::Remove blocks

* Block ListenerRegistration::Remove when there are outstanding callbacks.

* Test that remove does not block when called from the callback.
2020-07-06 13:06:36 -07:00
Gil 6f12f3871b Make snapshots in sync listener registration removal idempotent (#5945) 2020-06-30 09:32:37 -07:00
Paul Beusterien d4621a636f Use preserve_paths instead of CocoaPods private (#5758) 2020-06-09 05:21:28 -07:00
Denver Coneybeare df3679275c Add an integration test for calling clearPersistence() on a newly-created Firestore instance. (#5515) 2020-05-04 14:55:17 -04:00
Gil 7a58eba2e5 Remove firebase/firestore from paths in Firestore/core (#5374)
* Manual Xcode project fixups

* Remove `firebase/firestore` from paths in Firestore/core

This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.

Concretely:

  * `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
  * `Firebase/core/test/firebase/firestore` becomes
    `Firebase/core/test/unit`

Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
2020-04-20 14:57:34 -07:00
Gil 74f4ceb4c9 Fix unused variable warnings (#5389)
* Fix unused variable warnings

These are now exposed because libprotobuf is no longer polluting the
compiler command-line with -Wno-unused-parameter.

* Convert (void)var to __unused where possible
2020-04-20 14:23:36 -07:00
Paul BeusterienandMarek Gilbert 4ea4340285 Upgrade clang-format (#5265)
Co-authored-by: Marek Gilbert <mcg@google.com>
2020-04-03 11:38:31 -07:00
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