Commit Graph
91 Commits
Author SHA1 Message Date
zxu a441190635 Implement Firestore DatabaseInfo and port both Database{Id,Info} C++ to the iOS code (#738)
* implement Firestore DatabaseInfo in C++

* temporary stash changes; blocking on the massive renaming of .m to .mm

* add database_info_test to project

* finish port DatabaseId and fix style, modular fixing DatabaseInfo

* port DatabaseInfo

* remove FSTDatabase{ID,Info} and their tests from project

* fix unit test

* use namespace alias

* use namespace alias, leftover

* address more changes

* refactoring to use raw pointer instead of value for property

* address changes

* remove self->

* fix style

* remove the name suffix Alloc

* fix a bug
2018-02-06 13:51:11 -05:00
Michael Lehenbauer 13f572ea2c Increase expectation timeout to 25 seconds. (#744)
I'm doing this to:
1) Experimentally see if it improves the flakiness we've been seeing in the Query Conformance Tests.
2) Insulate us from the fact that GRPC seems to take a /minimum/ of 10 seconds to reconnect (at least in some cases) after a connection failure.

I've opened b/72864027 to revisit this in the future.
2018-02-02 10:25:41 -08:00
Gil d45900b85b Align tests and integration test header search paths (#737) 2018-02-01 13:14:53 -05:00
Gil 515625c47f Remove predecessorKey,Object,Document, etc (#735)
This is dead code.

I think it was probably useful in the RTDB because of the way it notified of changes, but we give changes with indexes in Firestore so I think we don't need it.
2018-02-01 07:55:49 -08:00
Gil ac30522234 Start on ArraySortedMap in C++ (#721)
* Implement ArraySortedMap.remove
* Implement ArraySortedMap.insert
* Ensure ArraySortedMap.insert avoids copying on duplicates
* Port more ArraySortedMapTests
2018-01-31 14:28:20 -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
Greg Soltis 3cbdbf2652 Schema migrations for LevelDB (#728)
* Implement schema versions

* Style fixes

* newlines, copyrights, assumptions

* Fix nullability

* Raw ptr -> shared_ptr

* kVersionTableGlobal -> kVersionGlobalTable

* Drop utils, move into static methods

* Drop extra include

* Add a few more comments

* Move version constant into migrations file

* formatting?

* Fix comment
2018-01-30 14:36:22 -08:00
zxu 6474a82fd6 Firestore DatabaseId in C++ (#727)
* Implement DataBaseId in C++

* add database_id_test to project

* fix project

* address changes

* fix style
2018-01-29 15:55:01 -05:00
Paul Beusterien 6dc13731f6 Version updates to 4.8.2 (#722) 2018-01-27 18:40:25 -08:00
Michael Lehenbauer 4d7c973369 Fix b/72502745: OnlineState changes cause limbo document crash. (#470) (#714)
[PORT OF https://github.com/firebase/firebase-js-sdk/pull/470]

Context: I made a previous change to raise isFromCache=true events when the
client goes offline. As part of this change I added an assert for
"OnlineState should not affect limbo documents", which it turns out was not
valid because:
* When we go offline, we set the view to non-current and call
	View.applyChanges().
* View.applyChanges() calls applyTargetChange() even though there's no target
	change and it recalculates limbo documents.
* When the view is not current, we consider no documents to be in limbo.
* Therefore all limbo documents are removed and so applyChanges() ends up
	returning unexpected LimboDocumentChanges.

Fix: I've modified the View logic so that we don't recalculate limbo documents
(and generate LimboDocumentChanges) when the View is not current, so now my
assert holds and there should be less spurious removal / re-adding of limbo
documents.
2018-01-27 15:03:05 -08:00
zxu af6976a907 normalize and port the rest of Firebase/Port code (#713)
* normalize bits
* normalize ordered_code
2018-01-27 14:53:27 -08:00
zxu 7226b4adf3 port TargetIdGenerator to iOS (#709)
* port TargetIdGenerator to iOS

* fix style

* move pointer property to instance variable

* TriggerTravis
2018-01-25 18:39:46 -05:00
zxu 821fb909a3 implement TargetIdGenerator in C++ for Firestore (#701)
* implement `TargetIdGenerator`

* address changes
2018-01-25 13:05:30 -05:00
zxu 5fdda3fa83 normalize string_util (#708)
* refactoring string_util
* port string_util to iOS
2018-01-25 13:03:07 -05:00
zxu bfa0e40795 Implement the rest of FieldValue types for C++ (#687)
* implement FieldValue for null and boolean.
* Implement number and string FieldValue.
* Implement object FieldValue.
* implement timestamp FieldValue.
* Implement number and string FieldValue.
* implement public type `Blob` and `GeoPoint`
* implement Blob FieldValue
* Implement GeoPoint FieldValue
* refactoring `Blob`
2018-01-25 09:14:19 -05:00
Gil 5bfcb3b8cf Cleanup imports and isEqual (#685)
* Fix headers

* Fix isEqual verbosity

* Fix isEqual for nullable properties

* Fix nullability on FSTTestDocSnapshot
2018-01-21 21:14:58 -08:00
Gil 39d8252300 Port comparison to C++ (#678)
This reimplements our comparison functions as C++ Comparators and then provides compatibility shims for interoperating with existing Objective-C usage.

A few specialized comparators aren't suitable for porting but only have a single usage (e.g. CompareBytes for comparing NSData * instances). In these cases I've moved them into the caller.

* Use int32_t for typeof(ID) in FSTDocumentReference

* Migrate callers of FSTComparison.h to Objective-C++

* Port comparison to C++

* Migrate usages of FSTComparison.h to C++ equivalents

* Remove FSTComparison
2018-01-19 12:27:11 -08:00
Paul Beusterien cda67e4faa Merge pull request #680 from firebase/release-4.8.1
Merge Release 4.8.1
2018-01-18 13:29:15 -08:00
Greg Soltis 70d401d483 Listen sequence numbers (#675)
* Generate and save sequence numbers for listens

* Add documentation

* Fix include path

* Fix unavailable comment

* Review feedback
2018-01-17 12:23:45 -08:00
zxu cac2c3ff7a implement FieldValue for null, boolean, and array in C++. (#637)
* implement FieldValue for null and boolean.

* refactoring to use union type instead of poly

* refactor using union design intead of poly

* refactoring to use anonymous union and fix styles

* small fix

* add field_value_test to the project

* fix warning of cmake and fix style
2018-01-17 13:18:54 -05:00
Gil 2700198d93 Add assert_test to the Xcode build (#671)
* Exclude stdio-backed assert from the Xcode build

* Add assert_test to the Xcode build
2018-01-16 13:16:58 -05:00
Michael Lehenbauer f2f0da7644 Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) 2018-01-15 10:35:04 -05:00
Michael Lehenbauer da506b86bc Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) 2018-01-12 15:54:42 -08:00
Paul Beusterien 8a44abbf4f Merge remote-tracking branch 'origin/master' into release-4.8.1 2018-01-12 09:26:10 -08:00
Paul Beusterien 17f5a9ba24 Fix import formatting (#660) 2018-01-12 09:24:50 -08:00
Benoit St-Pierre 0db5255609 Merge pull request #650 from firebase/bstpierre-version-bump
Version bump for 4.8.1 Release
2018-01-11 13:08:56 -05:00
Benoit St-Pierre a8aec78271 Update from master
Picking up a few last-minute changes to CHANGELOGs and tests for 4.8.1
release.
2018-01-11 13:06:28 -05:00
Benoit St-Pierre d5012f3fec Version bump for 4.8.1 Release
Updated the version numbers of pods which are being released in 4.8.1
2018-01-11 12:30:04 -05:00
rsgowman 1bafdb4ce5 Fix FSTLocalDocumentsView to allow multiple mutations while offline (#644)
* Fix FSTLocalDocumentsView to allow multiple mutations while offline.

Previously, only the last mutation would actually be visible.
2018-01-11 08:50:49 -08:00
Michael Lehenbauer dc0b29e9cf Run style.sh (#636)
Run style.sh (w/ clang-format version 6)
2018-01-10 09:28:44 -08:00
Michael Lehenbauer aa00c74449 Merge branch 'master' into mikelehen/merge-master-to-firestore-api-changes 2018-01-09 12:57:21 -08:00
Gil 0f6103e404 Port StringPrintf from //base (#624)
* Port StringPrintf from //base.

  Prefer this to approaches based on variadic templates. While the variadic
  template mechanisms are strictly safer, they result in binary bloat we
  can't afford.

  This is essentially the same StringPrintf previously open sourced as a
  part of protobuf, though updated for C++11 which saves a copy and a
  temporary buffer on the heap.

* Add abseil as a subdirectory of Firestore

  This saves having to redefine all the libraries that abseil defines as
  imported libraries.

* Rename firebase_firesture_util_log_* targets

  Cut the log out of the name to reflect that these will get more
  components besides just logging.
2018-01-08 08:57:36 -08:00
Sebastian Schmidt ed6c6f9fea Fixing potential race in ServerTimestamp tests 2018-01-05 10:34:38 -08:00
Gil 1ede1c9cb3 Use the log_apple.mm logger from C++ on iOS (#593)
* Add all .mm files in Firestore/core to the build (which matches
  log_apple.mm).
* Exclude log_stdio.cc
* Add log_test.cc to the project
2018-01-01 17:17:53 -08:00
Michael Lehenbauer faca4ea11b Rename all the onlineStateChanged methods to applyChangedOnlineState. (#574) 2017-12-19 16:05:20 -08:00
zxu 9ddf3637ac Firestore isEqual() on Public Types (#569)
* add bone code for new isEqual and unit test for old isEqual

*   add bone code for `FIRCollectionReference`, `FIRDocumentSnapshot`, `FIRFieldValue`, `FIRQuerySnapshot`, `FIRSnapshotMetadata`;
*   change inconsistenciness of `FIRFieldPath.isEqual` implementation;
*   add unit test (and file) for `FIRDocumentReferenceTest.m`, `FIRFieldPathTest.m`, `FIRQueryTests.testEquals`; `FIRGeoPoint` already has test and Blob is internal type.

* Implement isEqual for FIRCollectionReference

adding the working code and unit test.

* implement isEqual for FIRSnapshotMetadata

* Implement isEqual for FIRDocumentSnapshot

* Implement isEqual for FIRQuerySnapshot

* (un)implement `isEqual` for `FIRFieldValue`

Since `FIRFieldValue` both types are singleton, we do not need override `isEqual`. Add test to test the default `NSObject` `isEqual` works just fine.

* fix style with `scripts/style.sh`

* Implement hash for those with overridden isEqual without hash yet.

* refactor to use test helper functions -- FSTTestFirestore, FSTTestPath, FSTTestDocKey

* refactor using test helper `FSTTestDocSnapshot`, `FSTTestFieldPath`, `FSTTestQuery`, `FSTTestDoc`

* refactoring to use test helper method `FSTTestQuerySnapshot`,

* remove unneccessary nil-check, check isKindOfClass instead of isEqual

* refactoring: adding `FSTAPIHelpers.{h,m}`, `FSTTest{Collection,Document}Ref`,  better naming and style fix

* a file forgot in last commit

* mainly clean up import and some minor refactoring

* fix style via style.sh

* minor style fix

* add pragma ignored -Wnonnull
2017-12-19 13:47:04 -05:00
Kyle Ju c7f8d7f8da Merge pull request #576 from firebase/release-4.8.0
Release 4.8.0
2017-12-19 11:08:58 -05:00
Gil ea3369c192 Use angle brackets for nonlocal #includes in Firestore (#580) 2017-12-19 07:44:28 -08:00
Gil 52cdf0b25a Clean up warnings (#578)
* Clean up warnings
* Remove optional parens around ifs
2017-12-18 21:05:07 -08:00
Greg Soltis 52c7329f2a Expose network management (#566)
* Expose network management in public API

* Clean up a few more references to the internal access of network management

* Move test

* Update comments

* Swap _Nullable for nullable

* Fix comment

* Add tests, including swift

* Styling
2017-12-18 18:50:08 -08:00
Michael Lehenbauer 8db0eb618d Test cleanup: Adds a helper for waiting for FSTVoidErrorBlock callbacks.
* Add helper for waiting for FSTVoidErrorBlock callbacks.
* Remove errorEventHandler from FSTEventAccumulator.h too.
* Add synchronous enableNetwork / disableNetwork helpers.
* Workaround for batch writes test flakiness.
2017-12-18 14:21:11 -08:00
Sebastian Schmidt 31b90e6ea8 Fixing return type of verifySnapshotWithResolvedTimestamps
This should address a crash that happens when a debugger is attached
2017-12-18 14:07:30 -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
Sebastian Schmidt 08bd327bbf Adding Swift build test 2017-12-14 11:04:45 +08:00
Kyle Ju e16c38688b Update component versions for Firebase 4.8.0 (#561) 2017-12-12 17:24:19 -05:00
Sebastian Schmidt e006383cda Merge 2017-12-12 08:15:20 +08:00
Sebastian Schmidt e019a9461a Merge branch 'firestore-api-changes' into mrschmidt-timestamps 2017-12-12 08:03:59 +08:00
Sebastian Schmidt fe4783838e Addressing comments 2017-12-12 07:59:44 +08:00
Sebastian Schmidt 5b1ca51e72 Addressing comments 2017-12-12 07:11:39 +08:00
zxu 54ba423c87 Revisit commit method in FIRWriteBatch (#541)
* revisit FIRWriteBatch commit

*   make commitWithCompletion completion nullable;
*   add commit;
*   add unit test;
*   add swift build test for commit;
*   update CHANGELOG.
2017-12-11 15:37:01 -05:00