Commit Graph
41 Commits
Author SHA1 Message Date
Mila 07b7669175 Snapshot listener source from cache (#12370) 2024-03-11 14:53:11 -04:00
wu-hui 15a38d32c8 Lru Memory GC (#10905)
Adds LRU gc for memory cache.
2023-04-18 13:00:05 -04:00
Denver Coneybeare 04b7555228 Get rid of util and testutil namespace aliases (#8917) 2021-11-02 22:31:45 -04:00
Sebastian Schmidt 03a1ed5778 Rename the Auth package to Credentials (#8753) 2021-10-07 14:16:58 -06:00
Ehsan acc2d15b29 Fix warnings generated by Clang-Tidy (#8181)
* Remove unused namespace alias.

* Remove unused 'using' statements.

* Remove more unused 'using' and namspace aliases.

* Prefer absl::StrContains over comparing `find` result with `npos`.

* Remove more unused things.

* Prefer usage of `empty()` over `size()` when possible.

* Remove more unused things.

* Address code review.

* Address code review.

* More fixes to query_core.cc

* comment should match parameter name.

* Pre-allocate container capacity for better performance.

* More fixes.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Fix inconsistent declaration parameter name.

* Address bugprone-inaccurate-erase (inappropriate `erase` overload was used).

* Fix return type of move and copy constructor.

* Fix bugprone use after move.

* Fix formatting.

* Reflect the param name change in the doc.
2021-06-04 10:33:43 -05:00
wu-hui fbdca9590a Release Firestore bundles (#7717)
* Introduce new bundle.proto (#7283)

* Create leveldb "table"s for bundles (#7303)


* Add bundle cache (#7320)

* Bundle json parsing (#7356)

* BundleSerializer complete. (#7454)

* Bundles LocalStore change (#7466)

* Implement bundle reader to parse a bundle inputstream (#7527)

* Implement BundleLoader (#7536)

* Add public API for bundles and integration tests (#7621)

* Json parser as a hard copy (#7678)

* fix asan errors (#7686)

* Changelog entry

* Add public comments for bundles (#7694)

* Should 7.9.0

* API amendment
2021-03-16 17:07:47 -04:00
Denver Coneybeare e9c97ca7f1 Dequeue limbo resolutions when their respective queries are stopped (#7455) 2021-02-12 10:34:14 -05:00
Sebastian Schmidt 24a77d04c8 Import Spec tests (#6525)
* Import Spec tests

* Init

* Add recovery specs

* Update FSTSyncEngineTestDriver.mm
2020-09-22 18:48:04 -07: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
Denver Coneybeare cd6d0f1c1d Implement limbo resolution listen throttling (#5310) 2020-04-15 12:01:09 -04:00
Denver Coneybeare b05e9eb68d Update spec tests from changes in the firebase-js-sdk respository (#5278) 2020-04-07 10:10:26 -04: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
wu-hui 51e17ac8c5 Rename QueryData|Cache to TargetData|Cache (#4670)
* Rename done by CLion

QueryCache -> TargetCache
QueryData -> TargetData

* Fix cmake list indention

* Fixing ordering.
2020-01-15 13:47:26 -05: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
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -04: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
Gil 2e5e8b5676 Migrate FSTQueryData to C++ QueryData (#3595)
* Migrate FSTQueryData to C++ QueryData

* Remove FSTQueryData
2019-08-20 14:56:32 -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 13a1b33913 Migrate from FSTQuery to C++ Query (#3484) 2019-08-02 11:35:33 -07:00
Gil 0c11224789 Delete FSTDocumentKey (#3203) 2019-06-18 17:27:24 -07:00
Konstantin Varlamov 48009aaf7d C++ migration: port FSTViewSnapshot (#2441)
Also add a version of `ToString` taking an `absl::optional`
2019-03-01 14:16:41 -05:00
Konstantin Varlamov 13a7066403 C++ migration: eliminate FSTRemoteStore (#2338) 2019-02-08 14:37:42 -05:00
Konstantin Varlamov 9b3654b156 C++ migration: port write stream-related part of FSTRemoteStore (#2335) 2019-02-06 20:23:29 -05:00
Konstantin Varlamov 61f173eb12 C++ migration: port FSTOnlineStateTracker (#2325) 2019-02-01 15:44:18 -05:00
Konstantin Varlamov acb222026a C++ migration: port FSTWatchChange. (#2300) 2019-01-23 17:26:49 -05:00
Konstantin Varlamov 919be7eb88 C++ migration: port FSTDatastore and FSTMockDatastore (#2267) 2019-01-18 13:58:23 -05:00
Konstantin Varlamov 673b08592a C++: replace FSTMaybeDocumentDictionary with a C++ equivalent (#2139)
Also eliminate most usages of `FSTDocumentKey`, remove most methods from the Objective-C class and make it just a wrapper over `DocumentKey`. The only usage that cannot be directly replaced by C++ `DocumentKey` is in `FSTFieldValue`.
2018-12-10 11:57:08 -08: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
Gil a9f8a8fa7d Migrate FSTBatchID to C++ BatchId (#1700) 2018-08-16 10:44:26 -07:00
Gil 0725a5d4bb Migrate FSTTargetID to C++ TargetId (#1697) 2018-08-15 15:56:45 -07:00
Sebastian Schmidt d9b50374ab Add multi-client support to the iOS spec runner (#1631) 2018-08-03 17:06:04 -07:00
Greg Soltis 16a5210b3c Merging the LRU branch (#1600)
* Switch to reference delegates for garbage collection (#1410)

* Bump sequence number on resume token refresh

* Style

* Fix comment formatting

* Add FSTReferenceDelegate definition and documentation

* Add methods to return nil for delegates, wire up inMemoryPins

* Add hook for removing a reference

* Start work on reference delegates

* Fix up tests to support adding documents at a sequence number

* Implement removing references

* Remove from target when dropped from local view

* Fix warning

* Add hooks for removal from mutation queue

* Add hooks for limbo document updates

* Style

* Drop commented-out code

* Fixup after merging master

* Start importing delegate implementations

* Memory LRU tests pass

* Make memory lru work, start fixing up lru tests. All with hidden sequence numbers

* Most LRU tests passing w/ memory

* Big LRU test passes w/ memory

* Leveldb LRU tests pass

* All passing except local store tests

* All tests pass

* Fix localstore tests

* Revert removeQueryData change

* Remove collectGarbage calls

* Remove NoOp GC

* More cleanup

* Refactor FSTHelpers

* Cleanup and commenting

* Comments and cleanup

* Comments

* Drop nullable for reference delegates, and old persistence method on spec tests

* Fix missing sequence bump, remove unneeded targetID

* Style

* Drop commented-out code

* Satisfy the linters and copyrighters, etc.

* Drop more commented-out code

* Fix import -> include, NSUInteger -> int

* Start work on test comments

* FSTDocumentKey -> DocumentKey

* Sample of LRU test refactor (#1424)

* Sample of test refactor

* Drop errant 'struct' keyword

* More test refactoring

* Make gc a member variable too

* Tests refactored to use member variables

* Assign delegates procedurally, rather than passing in a block

* Fix up FSTLevelDB a little

* listens -> listenTargets

* Rename GCEnabled

* remove isSentinel

* reword comment

* Add case for non-eager GC to test

* Style

* Cleaning the lint trap

* Clean up LRU tests (#1433)

* Add copious helpers and some docs to lru tests

* Style

* Method name refactor, add comment

* Drop FSTGarbageCollector and FSTEagerGarbageCollector (#1440)

* Drop FSTGarbageCollector and FSTEagerGarbageCollector

* Drop unused containsKey from FSTLevelDBMutationQueue

* Style

* Include sequence number in FSTQueryData hash and isEqual (#1568)

* Include sequence number in FSTQueryData hash and isEqual methods

* Style

* Switch to util::Hash

* Fix preserving query cache metadata (#1569)

* Add failing test

* Move the restart tests to the leveldb test suite

* Style

* Add new persistence test helper

* Fix test failure

* Review feedback

* Style
2018-07-27 13:58:11 -07:00
zxu 4e1ffe4649 Port SnapshotVersion for the rest Firestore modulo (#1185)
* remove conversions in `Local` and `Remote`

* replace `FSTSnapshotVersion` in `Model`

* replace `FSTSnapshotVersion` in the rest

* let test check equal with C++ equal

* fix newly added code

* address changes
2018-05-01 13:37:53 -04:00
zxu cb8c4b6b1f port C++ DocumentKey to the rest of Firestore code (#977)
* port C++ DocumentKey to API's and Core's

* address changes

* address changes

* fix Hash return types
2018-03-27 14:33:39 -04:00
Michael Lehenbauer 34ebf10b0a Add 10 second timeout waiting for connection before client behaves as-if offline. (#872)
[Port of https://github.com/firebase/firebase-js-sdk/commit/0fa319e5e019dd0d40ab441d2ff9f8f6d4724e43]

* Refactored FSTOnlineState tracking out of FSTRemoteStore and into new
  FSTOnlineStateTracker component.
* Added a 10 second timeout to transition from OnlineState.Unknown to
  OnlineState.Offline rather than waiting indefinitely for the stream to
  succeed or fail.
* Removed hack to run SpecTests using an FSTDispatchQueue that wrapped
  dispatch_get_main_queue(). This was incompatible with [FSTDispatchQueue
  runDelayedCallbacksUntil:] since it queues work and blocks waiting for
  it to complete. Now spec tests create / use a proper FSTDispatchQueue.
* Added a SpecTest to verify OnlineState timeout behavior.
* Misc cleanup:
    * Renamed FSTOnlineState states: Failed => Offline, Healthy => Online
    * Renamed FSTTimerIds (ListenStreamConnection => ListenStreamConnectionBackoff)
    * Added ability to run timers from spec tests.
2018-03-05 09:49:41 -08:00
zxu fd9fd271d0 replacing Auth/FSTUser by C++ auth implementation (#804)
* replacing Auth/FSTUser by C++ auth implementation

* address changes
2018-02-15 17:23:08 -05:00
Paul Beusterien 17f5a9ba24 Fix import formatting (#660) 2018-01-12 09:24:50 -08:00
Michael Lehenbauer d4de7a6e86 b/68276665: Raise isFromCache=true events when offline (#567)
* Plumbs FSTOnlineState changes through to views.
* View sets this.current to false on FSTOnlineStateFailed, triggering
	isFromCache=true events. It will automatically be returned to true
	once the listen is reestablished and we get a new CURRENT message.
* Updated tests (and added one new one) to verify behavior.
* Unifies setOnlineStateToUnknown, setOnlineStateToHealthy, and
	updateAndBroadcastOnlineState into a single updateOnlineState
	method.
* Split disableNetwork into (public) disableNetwork and
	(private) disableNetworkWithTargetOnlineState methods..
* Some miscellaneous comment cleanup.

* Add missing comment per CR feedback.
2017-12-15 14:56:03 -08:00
Gil 4fbc96904f Use fully qualified imports in Firestore (#467)
This simplifies the import process back into google3 and allows us to add additional directories to the project without needing to update the project files for each directory we add. This shows up most clearly in the change to Firestore/Example/Firestore.xcodeproj/project.pbxproj: this no longer needs to list essentially every directory in the project as a header search path.

* Clang-format configuration for C++ files
* Add support C++-only sources to the podspec
* Podspec support for fully qualified imports
* xcodeproj changes for fully-qualified imports
* Use fully-qualified imports in Firestore sources
2017-11-16 20:52:01 -08:00
Sebastian Schmidt 9044d2ce21 Sending an empty write request before tearing down the stream (#438) 2017-11-08 17:04:41 -08:00
Gil bde743ed25 Release 4.3.0 (#327)
Initial release of Firestore at 0.8.0
Bump FirebaseCommunity to 0.1.3
2017-10-03 08:55:22 -07:00