Commit Graph
196 Commits
Author SHA1 Message Date
Gil 602c262c6b Add remaining tests to Xcode (#1256)
* Add classes in testutil and util to the project

  * Exclude util/iterator_adaptors_test which requires gmock
  * Exclude remote/serializer_test which is missing some paths

* Add iterator_adaptors_test and add gmock support

  * Add gmock support to the GoogleTest podspec we vendor
  * Add iterator_adaptors_test.cc to the Xcode project

* Add a script that verifies all tests are referenced in the project

* Add a travis check that all tests are referenced in the project

* Review feedback

* Moar feedback
2018-05-10 10:22:38 -07:00
Gil 9ba088053d Add missing tests to the Firestore project (#1254)
* Fix order of project elements

* Add immutable container tests to the Firestore project

* Fix style problems in TransformOperations

  * Method names should have an initial upper case character (except
    getters/setters)
  * Pointers bind to the type not the name in C++
  * Fix unsigned/signed comparison warning

* Make transform_operations.h Objective-C++ only

It turns out that you can't conditionally define virtual methods. This
causes multiple versions of the vtable to be emitted and when the linker
resolves all the vtable definitions for a class it picks one arbitrarily
causing failures for callers that expect some of the conditional methods
to be present.

* Add precondition_test and field_mask_test to the project

* Add field_transform_test and transform_operations_test to the project

* Clean up missing newline/excess comments

* Use braced initialization to avoid linter false positive on std::transform
2018-05-09 20:49:32 -07:00
Gil 6a97d15413 Align folders with actual test locations in the Firestore project (#1251) 2018-05-09 13:57:28 -07:00
Konstantin Varlamov dbcd179788 Firestore C++: compile ExecutorLibdispatch in Objective-C++ mode (#1237)
dispatch_queue_t is defined differently in libdispatch depending on
whether the library header is being include from Objective-C (or
Objective-C++) code, or else from C or C++ code. Make sure that all
source files in Firestore that include executor_libdispatch.h are
compiled in the same mode (Objective-C++) to avoid linker errors.
2018-05-08 19:37:20 -04:00
Michael Lehenbauer 8409f21830 Backport array contains / transform improvements from Web. (#1242) 2018-05-08 15:33:10 -07:00
Paul Beusterien bb8c87a028 merge 2018-05-08 10:59:19 -07:00
Konstantin Varlamov 38824e721e C++ migration: add AsyncQueue, the C++ version of FSTDispatchQueue (#1176)
AsyncQueue is a queue that executes given operations asynchronously,
enforcing that only a single operation is executing at any given time,
and that in-progress operations don't spawn more operations. The actual
execution is delegated to a platform-specific executor. Executor is an
interface for a FIFO queue that executes given operations serially. Two
implementations of Executor, one using libdispatch and the other using
C++11 standard library, are provided.

AsyncQueue is not used anywhere in the code base at this point.
2018-05-07 12:22:57 -04:00
Gil 5af6de9e69 Migrate FSTDocumentVersionDictionary to C++ DocumentVersionMap (#1231) 2018-05-05 09:00:53 -07:00
Gil a080e481b5 Port FSTDocumentKeySet to C++ DocumentKeySet (#1229)
* Define a Comparator for DocumentKey

* Automated migration from FSTDocumentKeySet to DocumentKeySet

* Manual fixups for DocumentKeySet

* Delete FSTDocumentKeySet
2018-05-05 08:10:51 -07:00
Paul Beusterien 56a529531b Disable pre-release repos (#1228) 2018-05-04 10:13:02 -07:00
Gil a1339483b4 Prepare Firestore for use as a static library (#1210)
* Remove spurious dependencies on other project targets in the integration tests

* Integration tests don't depend on OCMock

... and shouldn't

* Integration tests don't directly depend upon leveldb either

* Flatten Firestore example Podfile

Make the targets independent in Firestore/Example/Podfile and add a
workaround to deduplicate dependencies.

* Project file output from running pod update
2018-05-03 13:34:13 -07:00
Greg Soltis 66f2ce4c39 Bump sequence numbers when receiving a new resume token (#1214)
* Bump sequence number on resume token refresh

* Style

* Fix comment formatting
2018-05-03 12:11:39 -07:00
Michael Lehenbauer e91de9258a b/78539022: Fix test at risk of range violation errors depending on time-of-day. (#1213)
micros could underflow or overflow if the test was run at the wrong time... Replaced with hardcoded timestamps as I don't think making it time-dependent gains us interesting additional coverage.
2018-05-02 14:54:51 -07:00
Sebastian Schmidt 542d81ac68 Adding mergeFields support (#1141) 2018-05-02 11:10:19 -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
Gil 51be76700c Define a general hashing utility in C++ (#1195)
This is good enough to make it possible for the new C++ code to
interoperate with existing Objective-C code where `-hash` is required if
you override `-isEqual:`.
2018-05-01 08:57:31 -07:00
Greg Soltis c703431489 Port the feedback from the Java port (#1199)
* Port the feedback from the port

* Fix comment grammar
2018-04-30 19:47:10 -07:00
Greg Soltis 0748f265a6 Identify limbo-only document updates (#1167)
* Filter out document updates from target association changes

* Move remote-event-modifying methods onto remote event

* Style

* keep limbo docs in remote event

* Implement identification of limbo document updates

* Refactor a bit to handle removes as well

* Drop newline

* Handle synthesized limbo deletes

* Response to feedback

* Appease the style gods
2018-04-25 13:45:21 -07:00
zxu ff32b59036 Port SnapshotVersion for Remote (#1174)
* no-brainer replace FSTSnapshotVersion by SnapshotVersion in `Remote`

* delete `FSTSnapshotVersion` in `Remote`

* fix test

* partially revert RemoteEvent

* Revert "partially revert RemoteEvent"

This reverts commit 67e35bb6c1.

* fix a bug

* fix integration

* address changes
2018-04-25 14:13:57 -04:00
zxu f9bd6d3c94 Port SnapshotVersion for Local (#1182)
* no-brainer replace `FSTSnapshotVersion` with `SnapshotVersion`

* refresh code

* fix LocalStore

* fix LocalStore (partial revert 78e6c38)

* address changes
2018-04-25 14:05:36 -04:00
Paul Beusterien d691cb851b Firestore Podfile 5.0.0 update 2018-04-25 08:34:10 -07:00
Michael Lehenbauer e4384c3e80 Array Contains Queries (not added to public headers yet). (#1138) 2018-04-23 10:03:55 -07:00
Michael Lehenbauer 7dca635039 Move array transforms to internal header pending backend support. (#1139) 2018-04-20 14:48:59 -07:00
Greg Soltis 11b6c014fb Filter out document updates from target association changes (#1122)
* Filter out document updates from target association changes

* Move remote-event-modifying methods onto remote event

* Style
2018-04-20 13:33:54 -07:00
Gil 83a309df0a Rename iOS-specific targets with iOS-specific names (#1150)
* Rename targets:
  * Firestore_Example to Firestore_Example_iOS
  * Firestore_Tests to Firestore_Tests_iOS
  * Firestore_IntegrationTests to Firestore_IntegrationTests_iOS
  * AllTests to AllTests_iOS

* Rename associated schemes the same way

* Update Podfile to reference the new targets
2018-04-20 09:57:31 -07:00
Gil 9a3dbe937f Prep Firestore Podfile for multiple platforms (#1148) 2018-04-19 16:10:36 -07:00
Gil 8d9cd58d49 Update project for CocoaPods 1.5.0. (#1147) 2018-04-19 15:22:41 -07:00
Gil dae53d5c49 Clean up warnings in Firestore (#1146) 2018-04-19 13:59:57 -07:00
zxu 5d3c76f543 fix integration test (#1134) 2018-04-18 15:59:08 -04:00
rsgowman a5b3185ed3 Add GetOptions for controlling offline get behaviour (#655)
Add option to allow the user to control where DocumentReference.getDocument() and CollectionReference.getDocuments() fetches from. By default, it fetches from the server (if possible) and falls back to the local cache. It's now possible to alternatively fetch from the local cache only, or to fetch from the server only (though in the server only case, latency compensation is still enabled).
2018-04-18 10:30:37 -04:00
Michael Lehenbauer e36cc9610b Integration tests, changelog, and minor fixes for array transforms. (#1108) 2018-04-17 15:55:29 -07:00
Michael Lehenbauer f2ec9e11fb Serialize array transform mutations. (#1107)
* Serialize array transform mutations.
* Improve ArrayTransform constructor to avoid extra copying.
2018-04-17 15:07:25 -07:00
Michael Lehenbauer 360e58901c Implement local and server application of arrayUnion and arrayRemove transforms. (#1101) 2018-04-16 16:04:26 -07:00
Gil 33701fbc9c Fix the build and travis change detection (#1117)
* Fix typo in main.swift

* Fix change detection for Firestore in Travis
2018-04-16 14:46:03 -07:00
Gil a25d054874 Replace the SnapshotOptions object with the behavior enum. (#1109)
Instead of calling

  `get(field, SnapshotOptions.serverTimestampBehavior(.estimate))`

call

  `get(field, serverTimestampBehavior: .estimate)`
2018-04-16 13:50:11 -07:00
Greg Soltis 0ac71f294f Rewrite some LocalStore tests (#1114)
* Pull localstore tests from other branch

* Fix up the couple of tests that expected the assertion

* Style
2018-04-16 12:18:35 -07:00
Gil 4de2d80e43 Replace QueryListenOptions with simple booleans (#1106)
* Replace `QueryListenOptions` with simple booleans

Instead of calling

  addSnapshotListener(
      options:QueryListenOptions.includeQueryMetadataChanges()
                                .includeDocumentMetadataChanges())

call

  addSnapshotListener(includeMetadataChanges:true)

Also change `QuerySnapshot.documentChanges()` into a method which
optionally takes `includeMetadataChanges:true`. By default even when
listening to a query with `inlcudeMetadataChanges:true` metadata-only
document changes are suppressed because they're confusing.

* Revert QuerySnapshot.documentChanges back to a property

Add usage.
2018-04-15 16:56:43 -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
Ryan Wilson fd84cd60aa Merge pull request #1102 from firebase/release-4.13.0
Release 4.13.0
2018-04-13 20:34:55 -04:00
Michael Lehenbauer 60d43d7b09 Array Transforms public API and parsing
This includes the new FIRFieldValue sentinels, the FSTUserDataConverter code to parse them into internal ArrayTransform operations for use in an FSTTransformMutation, and some sanity testing in FSTMutationTests.

I still need to implement FSTTransformMutation support for local application and serialization (and then integration tests).
2018-04-13 14:22:41 -07:00
Paul Beusterien f23c3914bd Rename version 4.12.1 to 4.13 (#1092) 2018-04-13 11:24:52 -07:00
zxu 2ceea9b66e Port Precondition to C++ (#1040)
* port FieldMask to C++

* address changes

* address changes

* fix test

* address change

* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++

* address changes

* address changes

* address changes

* implement `FieldTransform` in C++

* port `FieldTransform`

* make `fieldTransforms` shared inside `context`

* Implement Precondition in C++ w/o test yet

* add unit test for `Precondition`

* port `Precondition`

* address changes

* address changes

* fix bugs for integration test

* address changes

* fix lint

* address changes

* address changes
2018-04-12 21:32:19 -04:00
Michael Lehenbauer c2d4d3a9cf Small cleanup to UserDataConverter / FieldValue sentinel code to make adding more FieldValue sentinels easier. (#1077)
Port of https://github.com/firebase/firebase-js-sdk/commit/b14678002bf6e8cc9ebd7561efbafe29315ceb8e and https://github.com/firebase/firebase-js-sdk/commit/b14678002bf6e8cc9ebd7561efbafe29315ceb8e.
2018-04-12 13:50:02 -07:00
Paul Beusterien e29010caf2 Update component versions for 4.12.1 2018-04-11 09:07:06 -07:00
Paul Beusterien 55eed807df Merge pull request #1067 from firebase/release-4.12.0
Release 4.12.0
2018-04-10 17:45:20 -07:00
zxu 2ac778f312 Port FieldTransform to C++ (#1033)
* port FieldMask to C++

* address changes

* address changes

* fix test

* address change

* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++

* address changes

* address changes

* address changes

* implement `FieldTransform` in C++

* port `FieldTransform`

* make `fieldTransforms` shared inside `context`

* address changes

* fix lint

* address changes
2018-04-10 16:28:22 -04:00
Gil 0a66187053 Add lint checking for Objective-C++ sources (#1048)
* lint.sh now lints Objective-C++ too

* cpplint checks system-style includes that should be user-style

This prevents it from recognizing project sources as if they were C
system headers and then complaining that they're in the wrong place.

* cpplint checks #imports and #includes

* cpplint checks that C++ system headers aren't #imported

* cpplint checks for C system headers that could be C++ system headers

* cpplint checks that Objective-C sources include their headers
2018-04-09 11:54:39 -07:00
zxu db717bf670 Port transform operations to C++ (#1020)
* port FieldMask to C++

* address changes

* address changes

* fix test

* address change

* Port transform operations (FSTTransformOperation, FSTServerTimestampTransform) to C++

* address changes

* address changes

* address changes

* address change
2018-04-05 11:52:07 -04:00
zxu 5fa10a9143 port FieldMask to C++ (#998)
* port FieldMask to C++

* address changes

* address changes

* fix test

* address change

* fix lint

* address changes

* Revert "address changes"

This reverts commit c75bb42851.
2018-04-04 12:40:46 -04:00