aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/core/src/firebase/firestore
Commit message (Collapse)AuthorAge
...
* Renames in serializer to reflect recent changes (#957)Gravatar rsgowman2018-03-23
| | | | | | | * Rename Writer::Encode* methods to Writer::Write* * Rename: s/stream/writer/ (approximately) but only where it applies to Writer (rather than pb_ostream_t).
* Switch FSTLevelDBQueryCache to use transactions (#942)Gravatar Greg Soltis2018-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start work on leveldb transactions * Style * Working API. Not plumbed in yet * Move files into correct place * Wrangling file locations and associations * Tests pass * Add some comments * style * Fix copyright * Rewrite iterator internals to handle deletion-while-iterating. Also add tests for same * Switch to strings instead of slices * Style * More style fixes * Start switching writegroup over * Swap out write group tracking for transaction usage * Style * Response to feedback before updating docs * Style * Add comment * Initialize version_ * Satisfy the linter * Start switching writegroup over * Swap out write group tracking for transaction usage * Style * Checkpoint before implementing BatchDescription * Style * Initial plumbing for leveldb local parts * Add model::BatchId * Port leveldb_key.{h,cc} * Add string StartsWith * Add leveldb_key_test.cc to the project * Revert back to using leveldb::Slice for read/describe These operations universally operate on keys obtained from leveldb so it's actually unhelpful to force all the callers to make absl::string_views from them. * Everything passing * Drop unused function * Style * STart work on reads * Swap reads in queryCache to use transactions * Fix up tests of querycache * Drop commented out code * Cleanup * Style * Fix up for passing tests * style * Renaming * Style * Start work on ToString for transactions * Add ToString() method to LevelDbTransaction * Style * lint * Fix includes, drop runTransaction * current_transaction -> currentTransaction * LevelDbTransaction::NewIterator now returns a unique_ptr * Style * Revert addition of util::StartsWith * Add log line * Style * Add log line * Style * Add debug log line for commits, drop unused BatchDescription * Fix an include, but mostly try to trigger a travis build
* Change write groups to use transactions (#912)Gravatar Greg Soltis2018-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start work on leveldb transactions * Style * Working API. Not plumbed in yet * Move files into correct place * Wrangling file locations and associations * Tests pass * Add some comments * style * Fix copyright * Rewrite iterator internals to handle deletion-while-iterating. Also add tests for same * Switch to strings instead of slices * Style * More style fixes * Start switching writegroup over * Swap out write group tracking for transaction usage * Style * Response to feedback before updating docs * Style * Add comment * Initialize version_ * Satisfy the linter * Start switching writegroup over * Swap out write group tracking for transaction usage * Style * Checkpoint before implementing BatchDescription * Style * Everything passing * Drop unused function * Style * Renaming * Style * Add log line * Style * Add debug log line for commits, drop unused BatchDescription
* Add `ToString()` to `LevelDbTransaction` (#946)Gravatar Greg Soltis2018-03-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Initial plumbing for leveldb local parts * Add model::BatchId * Port leveldb_key.{h,cc} * Add string StartsWith * Add leveldb_key_test.cc to the project * Revert back to using leveldb::Slice for read/describe These operations universally operate on keys obtained from leveldb so it's actually unhelpful to force all the callers to make absl::string_views from them. * Start work on ToString for transactions * Add ToString() method to LevelDbTransaction * Style * lint * Revert addition of util::StartsWith
* Port FSTLevelDBKey to C++ (#937)Gravatar Gil2018-03-21
|
* Change CredentialsProvider::TokenListener to use StatusOr<Token> (#945)Gravatar rsgowman2018-03-21
| | | | | | | | | | | | | * Change CredentialsProvider::TokenListener to use StatusOr Rather than a token plus error code/msg. * Eliminate the concept of an invalid Token Instead, we'll just use StatusOr<Token>. Note that unauthenticated tokens are handled as a special case; they're created via: Token::Unauthenticated() and are otherwise "valid", though attempting to retrieve the raw token on one of these tokens will cause an assertion failure.
* Add Status and StatusOr (#935)Gravatar rsgowman2018-03-19
| | | | * Pull in status files from tensorflow * Add missing dependency to immutable library
* port `DocumentKey` to non-container types of `Model/*` (#930)Gravatar zxu2018-03-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * naively remove FSTPath import and source/test files. * port FieldPath, part I * port FieldPath, part II * port ResourcePath, part I * port ResourcePath, part II * the grand commit to fix build errors * use testutil:: helper instead of those from FSTHelpers * fix test and lint * use c_str in errmsg directly * fix * fix * make code clean * fix integration test I missed * fix to avoid naming collision in preprocessor * address changes * address changes * address changes * fix: fieldMask are actually shared with different context. * address changes * add converter function between two DocumentKey implementations * add unit test * address changes * fix lint * using DocumentKey in model except for the container types `FSTDocumentDictionary`, `FSTDocumentKeySet`, and `FSTDocumentVersionDictionary` * change other place w.r.t. the use of `DocumentKey` in model * update parameter of test helpers from NSString to string_view * revert a temporary change used in debug * address changes
* Implements transactions for leveldb (#881)Gravatar Greg Soltis2018-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start work on leveldb transactions * Style * Working API. Not plumbed in yet * Move files into correct place * Wrangling file locations and associations * Tests pass * Add some comments * style * Fix copyright * Rewrite iterator internals to handle deletion-while-iterating. Also add tests for same * Switch to strings instead of slices * Style * More style fixes * Response to feedback before updating docs * Style * Add comment * Initialize version_ * Satisfy the linter * Fix style * snake_case * More snakes * LevelDBTransaction -> LevelDbTransaction
* Move core/types.h to model to prevent a core -> local -> core dependency ↵Gravatar Gil2018-03-15
| | | | cycle (#929)
* adding converters between DocumentKey (#900)Gravatar zxu2018-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * naively remove FSTPath import and source/test files. * port FieldPath, part I * port FieldPath, part II * port ResourcePath, part I * port ResourcePath, part II * the grand commit to fix build errors * use testutil:: helper instead of those from FSTHelpers * fix test and lint * use c_str in errmsg directly * fix * fix * make code clean * fix integration test I missed * fix to avoid naming collision in preprocessor * address changes * address changes * address changes * fix: fieldMask are actually shared with different context. * address changes * add converter function between two DocumentKey implementations * add unit test * address changes * fix lint
* Move creation of pb_ostream_t's into Writer (#920)Gravatar rsgowman2018-03-15
| | | | | | | | | | * Move creation of pb_ostream_t's into Writer Writer now owns these structs * Writer::FromBuffer -> Writer::Wrap * add todo for possible future simplification.
* Partial wrapping of pb_ostream_t (pt5) (#916)Gravatar rsgowman2018-03-14
| | | | Wraps encoding of FieldValue's. At this point, raw pb_ostream_t structs aren't used outside of Writer, except during creation of a Writer.
* grand PR to port the remaining paths (FieldPath and ResourcePath). (#865)Gravatar zxu2018-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * naively remove FSTPath import and source/test files. * port FieldPath, part I * port FieldPath, part II * port ResourcePath, part I * port ResourcePath, part II * the grand commit to fix build errors * use testutil:: helper instead of those from FSTHelpers * fix test and lint * use c_str in errmsg directly * fix * fix * make code clean * fix integration test I missed * fix to avoid naming collision in preprocessor * address changes * address changes * address changes * fix: fieldMask are actually shared with different context. * address changes * address changes
* Partial wrapping of pb_ostream_t (pt4) (#915)Gravatar rsgowman2018-03-13
| | | | Wraps encoding of FieldValue "Objects" (i.e. map<string, FieldValue>'s) and their entries (i.e. pair<string, FieldValue>'s)
* Partial wrapping of pb_ostream_t (pt3) (#907)Gravatar rsgowman2018-03-13
| | | Wraps encoding nested messages.
* Allow serializing arbitrary length FieldValues (#889)Gravatar rsgowman2018-03-12
| | | Uses a custom pb_ostream_t. Previously used a stack allocated 1k buffer.
* Fix test failures that occur during prod build (#910)Gravatar rsgowman2018-03-12
| | | | | | | | | | | | | | * Fix ArraySortedMap.ChecksSize test (when NDEBUG is enabled) assert() is a noop when NDEBUG is defined (i.e. during production builds) so the size assertion check doesn't occur. Assuming we want this check even during prod use, I've switched assert to FIREBASE_ASSERT. * s/FIREBASE_ASSERT/FIREBASE_DEV_ASSERT/g in ordered_code.cc This keeps the behaviour in line with the original (which purposely differs if NDEBUG is defined or not.) Discovered due to the test suite (correctly) breaking during a prod build.
* Partial wrapping of pb_ostream_t (pt2) (#903)Gravatar rsgowman2018-03-12
| | | Wraps the string encode method.
* Partial wrapping of pb_ostream_t (pt1) (#899)Gravatar rsgowman2018-03-09
| | | Wraps the varint based encode methods.
* [De]Serialize FieldValue map_values ("Objects") (#878)Gravatar rsgowman2018-03-08
| | | These can (recursively) contain other FieldValues.
* port paths to FSTDocumentKey (#877)Gravatar zxu2018-03-06
| | | | | | | | * replace path with C++ implementation in FSTDocumentKey.{h,mm} only * address changes * address changes
* add converters and port paths to FSTQuery (#869)Gravatar zxu2018-03-05
| | | | | | | | | | * add converters and fix FSTQuery.{h,m} only * address changes * a change forget to address * add a dummy function to make inline-only-library buildable
* Serialize (and deserialize) string values (#864)Gravatar rsgowman2018-02-28
|
* Add FieldValue.boolean_value() (#862)Gravatar rsgowman2018-02-27
|
* replacing Auth by C++ auth implementation (#802)Gravatar zxu2018-02-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lazy replacing FST(Firebase)CredentialsProvider by (Firebase)CredentialsProvider * lazy replacing FSTUser by User * adding error-code parameter to TokenListener * actually use const user& instead of pointer; also add an error util * add HashUser and pass into the unordered_map * use User in test * use c++ CredentialsProvider and subclass in test * fix unit test * use explicit capture in lambda instead of capture all by reference * cache currentUser explicitly when reset sync engineer test driver * objc object should be captured by value in lambda * replacing Auth/FSTUser by C++ auth implementation * address changes * replacing FSTGetTokenResult by C++ Token implementation * address changes * fix unintentional change in merging * patch the change in objc Auth up-stream * somehow, the lambda-version of set-user-change-listener does not work... fallback to block * address changes * fix another const& v.s. dispatch bug * fix more const& v.s. dispatch bug zxu123 committed * fix a bad sync line * address changes * address change * address change * fix upstream change from merge * fix upstream changes * Suggested fixes for cpp/port_auth (#846) * Get rid of MockDatastore factory This avoids the need to statically allocate (and leak) a credentials provider * Use absl::make_unique std::make_unique technically does not exist until C++14. * #include <utility> for std::move * Use std::future for the initial user * fix style
* Eliminate TypedValue and serialize direct from FieldValue to bytes. (#860)Gravatar rsgowman2018-02-27
| | | | | | | | This will likely only apply for proto messages that use 'oneof's. (Because we need to serialize these manually.) The problem was that as we were adding additional types, TypeValue was evolving into a parallel implementation of the FieldValue union. When serializing/deserializing oneofs we need to supply a custom value to serialize and a custom function to do the work. There's no value in translating from FieldValue to TypeValue just to store as this custom object. We might as well just store the FieldValue model directly and write the custom serializer/deserializer to use the model directly.
* Refactor [En|De]codeVarint to be symetric wrt tags (#837)Gravatar rsgowman2018-02-22
| | | | | | | | Since we can't decode a value before knowing it's type, I've pulled the tag handling out of these methods. More context over here: https://github.com/firebase/firebase-ios-sdk/pull/829
* Fix Firestore tests for M22 (#834)Gravatar Gil2018-02-22
| | | | | | | | | | | | | | | | | | | | | | * Add FIRFirestoreTests to the Firestore Xcode project * Avoid waitForExpectations:timeout: This API was added in Xcode 8.3, but we still build production releases with Xcode 8.2. waitForExpectationsWithTimeout:handler: is available from Xcode 7.2. * Add AppForUnitTesting Add a utility for constructing a Firebase App for testing. * Handle the nil UID from FIRAuth * Avoid running CMake tests twice * Only build app_testing on Apple platforms * Revise test.sh messages
* Avoid wrapping and rewrapping NSStrings when constructing DatabaseId (#833)Gravatar Gil2018-02-22
| | | | | | * Avoid wrapping and rewrapping NSStrings when constructing DatabaseId * Shorten DatabaseId::kDefaultDatabaseId
* Serialize (and deserialize) int64 values (#818) (#829)Gravatar rsgowman2018-02-22
|
* [En|De]codeUnsignedVarint -> [En|De]codeVarint (#817)Gravatar rsgowman2018-02-20
| | | | | | | | | | | | * [En|De]codeUnsignedVarint -> [En|De]codeVarint The 'unsigned' portion was misleading, as these varints work with both signed and unsigned integers. (The 'signed' varints also work with both signed and unsigned integers, but use zig-zag encoding so that negative numbers are encoded more efficiently. Note that 'signed' varints aren't used in the Value proto, so won't appear in the serializer class for at least the short term.) Added some docstrings to help disambiguate this.
* replacing FSTGetTokenResult by C++ Token implementation (#805)Gravatar zxu2018-02-20
| | | | | | | | | | | | | | | | | | | | * replacing Auth/FSTUser by C++ auth implementation * address changes * replacing FSTGetTokenResult by C++ Token implementation * address changes * address changes * fix another const& v.s. dispatch bug * fix more const& v.s. dispatch bug zxu123 committed * fix * passing by value in callback
* Serialize (and deserialize) bool values (#791)Gravatar rsgowman2018-02-16
|
* replacing Auth/FSTUser by C++ auth implementation (#804)Gravatar zxu2018-02-15
| | | | | | * replacing Auth/FSTUser by C++ auth implementation * address changes
* Serialize and deserialize null (#783)Gravatar rsgowman2018-02-13
| | | | | | | | | | | | | | | | | | | | | | | | | | * Build (grpc's) nanopb with -DPB_FIELD_16BIT We require (at least) 16 bit fields. (By default, nanopb uses 8 bit fields, ie allowing up to 256 field tags.) Also note that this patch adds this to grpc's nanopb, rather than to our nanopb. We'll need to eventually either: a) we instruct grpc to use our nanopb b) we rely on grpc's nanopb instead of using our own. (^ marked as a TODO for now.) * Add some dependant protos Imported from protobuf. Nanopb requires these to be present (though anything using libprotobuf does not, as these are already built into that.) * Add generated nanopb protos based off of newly added proto definitions * Build the nanopb protos * Serialize and deserialize null
* Port Firestore Document to C++ (#777)Gravatar zxu2018-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * implement SnapshotVersion and test * update project * implement MaybeDocument and test * move snapshot-version from core to model * fix a bug * implement Document and test * implement NoDocument * adding type tag and fix style * fix a few bugs, discovered after merging and test run. * add assert to check FieldValue type and more test for comparision. * address changes * allow moving FieldValue to construct Document. * address changes * add document tests to project * use std::less convention * make Type::Unknown static initializer
* Update FieldValue of type Reference (#775)Gravatar zxu2018-02-12
| | | | | | | | | | * update FieldValue of type Reference * address change * fix bad path string literal in test * use ReferenceValue and qualified name
* C++ port: add C++ equivalent of FSTDocumentKey. (#762)Gravatar Konstantin Varlamov2018-02-09
| | | | | Also move kDocumentKeyPath to the only point of usage - make it a static member variable of FieldPath.
* port Firestore SnapshotVersion in C++ (#767)Gravatar zxu2018-02-09
| | | * implement SnapshotVersion and test
* port Firestore Auth module in C++ (#733)Gravatar zxu2018-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement firestore/auth/user * add user to project and some fixes * implement firestore/auth/{credentials_provider,empty_credentials_provider} * implement firestore/auth/firebase_credentials_provider * refactoring firebase_credentials_provider and add (disabled but working) unit test * add auth test to project * address changes * small fix to style and project * fix the firebase_credentials_provider_test * fix style * address changes * revert the change to static mutex_ * remove my custom plist path * fix style * address changes * refactoring FirebaseCredentialsProvider to fix the issue w.r.t. auth global dispatch queue * add /*force_refresh=*/ tag to bool literal for style purpose * Use a shared_ptr/weak_ptr handoff on FirebaseCredentialsProvider (#778) * Revert "refactoring FirebaseCredentialsProvider to fix the issue w.r.t. auth global dispatch queue" This reverts commit 87175a4146267d403a774f138b85f8d3b532fa4b. * Use a shared_ptr/weak_ptr handoff on FirebaseCredentialsProvider This avoids any problems with callsbacks retaining pointers to objects destroyed by a C++ destructor
* cmake build fixes (#770)Gravatar rsgowman2018-02-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix nanopb (in cmake build) Look for binaries in the src dir (since that's where we build now.) This error would be masked if a previous build had completed prior to switching nanopb to build out of src. Also, don't patch the protoc path multiple times. This could be triggered by (eg) 'make && make clean && make'. * Add resource_path.{h,cc} to the cmake build * Fix signed/unsigned int comparison warnings * Ensure FieldValue tag_ is initialized during cp/mv ctor. Otherwise, the assignment operator attempts to deallocate based on the (uninitialized) tag_ variable, posssibly leading to segfaults. * Fix tests that throw exceptions. The (previous) tests checked to ensure that an abort() occurs, but if ABSL_HAVE_EXCEPTIONS is defined on non-macos (which is currently the default) then the assertions will throw a std::logic_error rather than abort()ing. On macos, an exception is thrown too, but the exception doesn't derrive from std::exception, so ASSERT_DEATH_* doesn't catch it (hence why ASSERT_DEATH_* actually works.) To resolve this, I've switched to ASSERT_ANY_THROW.
* Explicitly specify the default constructor to FieldPath (#773)Gravatar Gil2018-02-08
| | | | | | | | | | | Xcode prior to 8.3 does not accept an explicitly defaulted constructor (`= default`) for the purposes of default initializing a const object. This fixes a build failure under Xcode 8.2: ``` Firestore/core/src/firebase/firestore/model/field_path.cc:144:26: error: default initialization of an object of const type 'const firebase::firestore::model::FieldPath' without a user-provided default constructor static const FieldPath empty_path; ```
* C++ port: port FSTFieldPath and FSTResourcePath to C++ (#749)Gravatar Konstantin Varlamov2018-02-06
| | | Similar to Objective-C, FieldPath and ResourcePath share most of their interface (and implementation) by deriving from BasePath (using CRTP, so that factory methods in BasePath can return an instance of the derived class).
* Merge pull request #747 from firebase/rsgowman/nanopbGravatar rsgowman2018-02-06
|\ | | | | Integrate nanopb
* | Implement Firestore DatabaseInfo and port both Database{Id,Info} C++ to the ↵Gravatar zxu2018-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * ./style.shGravatar Rich Gowman2018-02-06
| |
| * Hook up nanopb to firestorep projectGravatar Rich Gowman2018-02-06
|/ | | | | Use remote/serializer placeholder class as a hook for the test to ensure nanopb headers can be found, and test can be linked.
* Start on ArraySortedMap in C++ (#721)Gravatar Gil2018-01-31
| | | | | | * Implement ArraySortedMap.remove * Implement ArraySortedMap.insert * Ensure ArraySortedMap.insert avoids copying on duplicates * Port more ArraySortedMapTests
* Firestore DatabaseId in C++ (#727)Gravatar zxu2018-01-29
| | | | | | | | | | | | * Implement DataBaseId in C++ * add database_id_test to project * fix project * address changes * fix style