* Add a MakeStringView benchmark
Turns out this is worse than just creating a std::string:
BM_MakeString 29 ns 29 ns 189065849
BM_MakeStringView 59 ns 59 ns 93013367
* Convert database_id to take std::string
* Convert DatabaseInfo to take std::string
* Convert User to take std::string
* Convert Token to take std::string
* Convert MakeStringView([NSString stringWithFormat:]) to StringFormat
* Move Path into a separate filesystem library
* Add a filesystem interface and an NSFileManager-based implementation
* Use Path/Filesystem in FSTPersistenceTestHelpers
* Use nanopb::Reader, Writer, in the serializer's public methods. This eliminates overloads that take raw bytes.
* Refactor the serializer's return values from Status, StatusOr<T> to void, optional<T> (or unique_ptr<T>) for encoding/decode methods, respectively.
* Errors during serializer encoding methods now fatal. Previously, we'd propagate the errors back to the caller, but there aren't any errors that could realistically be recovered from. So now we just abort(). (This is in contrast to *de*coding methods, which could generate errors that we might want to recover from.)
* Reduce early returns in the serializers
* Unify public/private method return values of the serializers. Now the private methods return void/optional, just like the public methods.
* Reader::ReadTag now tracks the last read tag. This allows:
* RequireWireType to not need it as a parameter
* SkipField to not need it as a parameter
* ReadTag to be inlined into most switch statements
* Move RequireWireType into ReadX methods
* Reader::SkipField -> Reader::SkipUnknown
* Add ReadNestedMessage overload in order to accept non-static functions.
* Add a few using statements to simplify code. (Also keeps local serializer more in sync with the remote serializer.)
* Use nullopt/nullptr instead of {}
* Reader::update_status() -> Fail()
* Add DecodeSnapshotVersion
* Don't directly update status within nanopb::Reader. Instead, call Reader::Fail() (which calls Status::Update()). This ensures we don't accidentally overwrite the first error status with
a subsequent one.
* Migrate to LevelDbVersionKey
* Migrate to LevelDbMutationKey
* Migrate to LevelDbDocumentMutationKey
* Migrate to LevelDbMutationQueueKey
* Migrate to LevelDbTargetGlobalKey
* Migrate to LevelDbTargetKey
* Migrate to LevelDbQueryTargetKey
* Migrate to LevelDbTargetDocumentKey
* Migrate to LevelDbDocumentTargetKey
* Migrate to LevelDbRemoteDocumentKey
Also:
- Remove FSTLevelDBKey and tests
- Remove StringView and tests
* Convert FSTLevelDBKeyTests to DescribeKey()
Note that the description coverage is already in leveldb_key_test.cc
* Rename Describe to DescribeKey
* Fix pointer alignment in leveldb_key.cc
* Add DescribeKey overloads for other string types
Unforunately, both leveldb::Slice and absl::string_view implicitly
convert from std::string which makes providing overloads for both
ambiguous for anything that converts to either.
* Migrate [FSTLevelDBKey descriptionForKey:] to DescribeKey()
* Fixes decoding WriteResults for deletes (with no updateTime). (#1622)
This should resolve#1591. We were inadvertantly decoding the WriteResult as
having an updateTime of 0 which caused it to be older than the version of the
document in the RemoteDocumentsCache. Therefore we kept the old version in
the cache instead of persisting the deleted document. This caused the document
to reappear in the query results until we resolved it via a limbo resolution.
* Add changelog entry for delete WriteResult fix (d9f116). (#1623)
* Actually this fix is going out with 0.13.0
This should resolve#1591. We were inadvertantly decoding the WriteResult as
having an updateTime of 0 which caused it to be older than the version of the
document in the RemoteDocumentsCache. Therefore we kept the old version in
the cache instead of persisting the deleted document. This caused the document
to reappear in the query results until we resolved it via a limbo resolution.
* Add UTF-8 to wide character conversions for Windows pathnames.
* Explicitly mark UTF-8 string literals
Without this, string literals are encoded in the host's encoding, which
can be anything including CP-1252 on Windows, which will generate
invalid UTF-8 data when fed through our serializer.
* 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
* Added `FIELDPATH` to the list of available fuzzing targets.
* Added fuzzing method for creating `FIRFieldPath` objects.
* Added corpus and dictionary for `FIRFieldPath`.
* Added fuzzing targets read from env variable.
* Refactored Serializer fuzz tests in a separate file
* Separate header file for each fuzzing target.
* Write crashing outputs using `artifact_prefix` flag to `NSTemporaryDirectory`.
* Step one of benchmarking
* Benchmark writing to leveldb
* Comment out and style
* More comments
* Fix warnings
* Someday I will lint as good as computer
* Some light commenting and static-ing
* It seems to be working?
* Remove unused test file
* Drop commented-out deps
* Revert string quoting in pbxproj file
* Drop reference to deleted file
* Move podspec, fix import
* Lots of C++ style changes
* Style
* Drop whitespace
This is a force fix for potential existence filter mismatches caused by
firebase/firebase-ios-sdk#1548
The essential problem is that when resuming a query, the server is
allowed to forget deletes. If the number of incorrectly synthesized
deletes matches the number of server-forgotten deletes then the
existence filter can give a false positive, preventing the cache from
self healing.
Dropping the query cache clears any client-side resume token which
prevents a false positive existence filter mismatch.
Note that the remote document cache and mutation queues are unaffected
so any cached documents that do exist will still work while offline
https://github.com/firebase/firebase-js-sdk/pull/1019
This is a force fix for potential existence filter mismatches caused by
firebase/firebase-ios-sdk#1548
The essential problem is that when resuming a query, the server is
allowed to forget deletes. If the number of incorrectly synthesized
deletes matches the number of server-forgotten deletes then the
existence filter can give a false positive, preventing the cache from
self healing.
Dropping the query cache clears any client-side resume token which
prevents a false positive existence filter mismatch.
Note that the remote document cache and mutation queues are unaffected
so any cached documents that do exist will still work while offline
https://github.com/firebase/firebase-js-sdk/pull/1019
[Port of https://github.com/firebase/firebase-js-sdk/pull/1014]
This fixes an issue occurring when a limbo target receives a documentUpdate,
then a global snapshot, and then a CURRENT. Because there was a global
snapshot before the CURRENT, WatchChangeAggregator has no pending document
updates and calls SyncEngine.remoteKeysForTarget to see if we previously got any
document from the backend for the target. See:
https://github.com/firebase/firebase-js-sdk/blob/6905339235ad801291edc696dd75a08e80647f5b/packages/firestore/src/remote/watch_change.ts#L422
Prior to this change, remoteKeysForTarget returned empty because
it relies on our Views to track the contents of the target, and we don't
have Views for limbo targets. Thus WatchChangeAggregator incorrectly
manufactures a NoDocument document update which deletes data from our
cache.
The fix is to have SyncEngine track the fact that we did indeed get
a document for the limbo resolution and return it from
remoteKeysForTarget.
[Port of https://github.com/firebase/firebase-js-sdk/pull/1014]
This fixes an issue occurring when a limbo target receives a documentUpdate,
then a global snapshot, and then a CURRENT. Because there was a global
snapshot before the CURRENT, WatchChangeAggregator has no pending document
updates and calls SyncEngine.remoteKeysForTarget to see if we previously got any
document from the backend for the target. See:
https://github.com/firebase/firebase-js-sdk/blob/6905339235ad801291edc696dd75a08e80647f5b/packages/firestore/src/remote/watch_change.ts#L422
Prior to this change, remoteKeysForTarget returned empty because
it relies on our Views to track the contents of the target, and we don't
have Views for limbo targets. Thus WatchChangeAggregator incorrectly
manufactures a NoDocument document update which deletes data from our
cache.
The fix is to have SyncEngine track the fact that we did indeed get
a document for the limbo resolution and return it from
remoteKeysForTarget.
* Rename utils.cmake to cc_rules.cmake
This makes it less of a dumping ground
* Fix sign mismatch in FIRApp
* Implement a podspec_framework CMake function
... that generates a CMake framework library target from a podspec.
* Remove manual CMake scripts for xcodebuild
* Move main.swift to BasicCompileTests.swift
* Remove SwiftBuildTest from the Podfile, Xcode project, build.sh
Add Firestore_SwiftTests_iOS, but only if building with Xcode 9 or
better.
* Add a travis stage that tests building Firestore with Xcode 8.3.
* Simulate on a device available in Xcode 8
* Fix compile errors under Xcode 8.3.3
* Remove Firestore_SwiftTests_iOS from the Firestore_Tests_iOS Scheme
I'll create a new target for this but in another PR.
* Add an entry to CHANGELOG.md
Rather than previously inlining it in the calling code. This is to unify
filter creation across platforms.
(This change involves altering FSTFilter from a protocol to an abstract
class.)
* Project file updates from sync_project.rb
* Fix misc compile errors under VS2017
* Fix util/hashing under VS2017
std::hash<int> is not just a pass through in Microsoft's STL.
* Disable unsafe code warnings in VS2017
... where comparing against a reference implementation that has no easy
safe equivalent.
* Handle drive letters in paths on Windows
* Add Auth interoperability library.
This allows other SDKs to retrieve the user ID and fetch a new
Auth token in a type-safe way through the Core container.
* Remove unnecessary import.
* Add missing copyright.
* Resolve comments.
- Remove unnecessary umbrella header.
- Move to version 1.0.
- Add tvOS support for app lifecycle changes.
* Move public interop headers to private.
* Add public_header_files too.
* Moved headers back into public.
* Shorten Interoperability and Interoperable to Interop.
* Add AuthInterop to travis linting.
* Fixed tag format in AuthInterop.podspec.
* Add AuthInterop path to Firestore Podfile.
This is a pretty close port of `FSTExponentialBackoff`. The changes are pretty minor:
* delay is calculated using <chrono> duration types, not plain numbers, which should be a little more type-safe;
* split a piece of code into a ClampDelay function, because it's reasonably close to std::clamp;
* rephrased the class-level comment to make it clearer that the first attempt always has delay = 0;
* added simple tests (other platforms don't have tests for this).
Also make sure that canceling a DelayedOperation is always valid.
This uses the newly-added allMutationBatchesAffectingDocumentKeys to find/deserialize all such batches in one go and then reuse the batches while processing a set of keys.