Skip to content

Migrate FieldValue to Protobuf #8124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
4f537e7
Add FieldValue helpers (#7642)
schmidt-sebastian Mar 12, 2021
07372a7
Mutable Documents (#7722)
schmidt-sebastian Mar 17, 2021
a12b78e
Add ObjectValue (#7712)
schmidt-sebastian Mar 18, 2021
b089bd9
Run migration to rewrite canonical IDs (#7850)
wu-hui Apr 7, 2021
cea03e9
Merge
schmidt-sebastian Apr 9, 2021
1d7f0d5
Merge branch 'master' into mrschmidt/mutabledocuments
schmidt-sebastian Apr 12, 2021
38cefe1
UserDataReader (#7843)
schmidt-sebastian Apr 12, 2021
e8960f9
UserDataWriter (#7842)
schmidt-sebastian Apr 13, 2021
032be48
Merge branch 'master' into mrschmidt/mutabledocuments
schmidt-sebastian Apr 22, 2021
6f3ef43
Delete no longer used files (#7984)
schmidt-sebastian Apr 28, 2021
f07ef0d
Document/MutableDocument changes (#7996)
schmidt-sebastian Apr 29, 2021
66bde46
BundleSerializer changes for Protobuf migration (#7999)
schmidt-sebastian Apr 29, 2021
42d1cb7
NanoPB utilities for FieldValue migration (#7986)
schmidt-sebastian Apr 30, 2021
e465253
FieldValue changes for transform_operation (#8017)
schmidt-sebastian May 3, 2021
86ff2c4
LocalStore changes for Protobuf migration (#8025)
schmidt-sebastian May 3, 2021
d59d753
Test Refactor for Protobuf-backed FieldValue (#8003)
schmidt-sebastian May 4, 2021
cd1fd22
Changes in the iOS API for FieldValue migration (#8034)
schmidt-sebastian May 5, 2021
64c05a7
SyncEngine changes for FieldValue migration (#8035)
schmidt-sebastian May 6, 2021
30082cd
FieldFilter changes for Protobuf migration (#8036)
schmidt-sebastian May 6, 2021
330ed4a
ObjectValue changes (#8007)
schmidt-sebastian May 10, 2021
e703e19
Preserve order in ArrayUnion (#8050)
schmidt-sebastian May 11, 2021
c98ddc6
LocalDocumentsView FieldValue migration (#8046)
schmidt-sebastian May 11, 2021
9e65580
Protobuf-backed Mutations (#8040)
schmidt-sebastian May 13, 2021
20d6893
TestUtil methods that create Protobuf (#8008)
schmidt-sebastian May 13, 2021
518cdbd
Protobuf changes for View/FirestoreClient (#8071)
schmidt-sebastian May 13, 2021
e19483b
Random test migrations to Protobuf (#8072)
schmidt-sebastian May 13, 2021
20e3266
RemoteDocumentCache changes (#8043)
schmidt-sebastian May 14, 2021
fe45beb
Update Query code to use Protobuf (#8070)
schmidt-sebastian May 14, 2021
e614d95
ValueUtil changes for FieldValue migration (#7991)
schmidt-sebastian May 14, 2021
7caa6c9
Objective-C Test Changes (#8073)
schmidt-sebastian May 17, 2021
a31f425
Migrate Serializer to Protobuf (#8076)
schmidt-sebastian May 17, 2021
364e8e4
Remaining Bundle changes (#8075)
schmidt-sebastian May 20, 2021
44d05ed
Finish FieldValue migration to Protobuf (#8101)
schmidt-sebastian May 20, 2021
fd9ef58
Add Changelog
schmidt-sebastian May 20, 2021
56ec634
Drop the shared pointer for Bound (#8126)
schmidt-sebastian May 20, 2021
8ef5191
Use parseQueryHelper (#8125)
schmidt-sebastian May 21, 2021
eec37c6
Merge branch 'master' into mrschmidt/mutabledocuments
schmidt-sebastian May 21, 2021
771ab33
Add IsMap (#8135)
schmidt-sebastian May 25, 2021
39d0dbf
Add IsMap (#8135)
schmidt-sebastian May 25, 2021
1e6b729
Fix build warning (#8195)
schmidt-sebastian Jun 4, 2021
37a294f
Reduce ObjectValue copies (#8187)
schmidt-sebastian Jun 5, 2021
a8fdb7e
Merge
schmidt-sebastian Jun 9, 2021
0b42299
Merge branch 'mrschmidt/mutabledocuments' of github.com:firebase/fire…
schmidt-sebastian Jun 9, 2021
f1818bf
Fix bad merge
schmidt-sebastian Jun 9, 2021
e840014
Fix access after std::move
schmidt-sebastian Jun 9, 2021
f47ccf0
Formatting
schmidt-sebastian Jun 9, 2021
0c58e7b
Wrap Protobuf for Query Filters in Messages (#8231)
schmidt-sebastian Jun 12, 2021
d3b0e1b
ObjectValue should take ownership of values (#8236)
schmidt-sebastian Jun 15, 2021
4ea89b8
Don't leak Query name (#8237)
schmidt-sebastian Jun 15, 2021
0328ce3
Bundle takes SharedMessage (#8242)
schmidt-sebastian Jun 17, 2021
79c8f75
Use Message as input type for nanopb protos (#8244)
schmidt-sebastian Jul 15, 2021
b3e33ba
Merge
schmidt-sebastian Jul 15, 2021
a4d97fa
Merge branch 'mrschmidt/mutabledocuments' of github.com:firebase/fire…
schmidt-sebastian Jul 15, 2021
cc36140
Fix merge
schmidt-sebastian Jul 15, 2021
af392a4
Formatting
schmidt-sebastian Jul 15, 2021
5537a12
Fix build
schmidt-sebastian Jul 16, 2021
5479b48
Fix leak in reference value parsing (#8424)
schmidt-sebastian Jul 22, 2021
4d701d9
Merge branch 'master' into mrschmidt/mutabledocuments
schmidt-sebastian Jul 22, 2021
af45258
Update CHANGELOG.md
schmidt-sebastian Jul 22, 2021
63abde3
Update CHANGELOG.md
schmidt-sebastian Jul 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FirebaseFirestore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Google Cloud Firestore is a NoSQL document database built for automatic scaling,
abseil_version = '0.20200225.0'
s.dependency 'abseil/algorithm', abseil_version
s.dependency 'abseil/base', abseil_version
s.dependency 'abseil/container/flat_hash_map', abseil_version
s.dependency 'abseil/memory', abseil_version
s.dependency 'abseil/meta', abseil_version
s.dependency 'abseil/strings/strings', abseil_version
Expand Down
3 changes: 3 additions & 0 deletions Firestore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Unreleased
- [changed] Internal refactor to improve serialization performance.

# v8.4.0
- [fixed] Fixed handling of Unicode characters in log and assertion messages
(#8372).
Expand Down
112 changes: 56 additions & 56 deletions Firestore/Example/Firestore.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions Firestore/Example/Tests/API/FIRQuerySnapshotTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
using firebase::firestore::model::DocumentComparator;
using firebase::firestore::model::DocumentKeySet;
using firebase::firestore::model::DocumentSet;
using firebase::firestore::model::DocumentState;

using testutil::Doc;
using testutil::DocSet;
Expand Down Expand Up @@ -88,8 +87,8 @@ - (void)testEquals {
}

- (void)testIncludeMetadataChanges {
Document doc1Old = Doc("foo/bar", 1, Map("a", "b"), DocumentState::kLocalMutations);
Document doc1New = Doc("foo/bar", 1, Map("a", "b"), DocumentState::kSynced);
Document doc1Old = Doc("foo/bar", 1, Map("a", "b")).SetHasLocalMutations();
Document doc1New = Doc("foo/bar", 1, Map("a", "b"));

Document doc2Old = Doc("foo/baz", 1, Map("a", "b"));
Document doc2New = Doc("foo/baz", 1, Map("a", "c"));
Expand Down
42 changes: 22 additions & 20 deletions Firestore/Example/Tests/API/FSTAPIHelpers.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
#import "Firestore/Source/API/FIRFirestore+Internal.h"
#import "Firestore/Source/API/FIRQuerySnapshot+Internal.h"
#import "Firestore/Source/API/FIRSnapshotMetadata+Internal.h"
#import "Firestore/Source/API/FSTUserDataConverter.h"
#import "Firestore/Source/API/FSTUserDataReader.h"

#include "Firestore/core/src/core/view_snapshot.h"
#include "Firestore/core/src/model/document.h"
#include "Firestore/core/src/model/document_set.h"
#include "Firestore/core/src/model/mutable_document.h"
#include "Firestore/core/src/nanopb/message.h"
#include "Firestore/core/src/remote/firebase_metadata_provider.h"
#include "Firestore/core/src/util/string_apple.h"
#include "Firestore/core/test/unit/testutil/testutil.h"
Expand All @@ -45,13 +47,14 @@
using firebase::firestore::api::SnapshotMetadata;
using firebase::firestore::core::DocumentViewChange;
using firebase::firestore::core::ViewSnapshot;
using firebase::firestore::google_firestore_v1_Value;
using firebase::firestore::model::DatabaseId;
using firebase::firestore::model::Document;
using firebase::firestore::model::DocumentComparator;
using firebase::firestore::model::DocumentKeySet;
using firebase::firestore::model::DocumentSet;
using firebase::firestore::model::DocumentState;
using firebase::firestore::model::FieldValue;
using firebase::firestore::model::MutableDocument;
using firebase::firestore::nanopb::Message;

using testutil::Doc;
using testutil::Query;
Expand Down Expand Up @@ -82,15 +85,15 @@
NSDictionary<NSString *, id> *_Nullable data,
BOOL hasMutations,
BOOL fromCache) {
absl::optional<Document> doc;
absl::optional<MutableDocument> doc;
if (data) {
FSTUserDataConverter *converter = FSTTestUserDataConverter();
FieldValue parsed = [converter parsedQueryValue:data];
FSTUserDataReader *reader = FSTTestUserDataReader();
Message<google_firestore_v1_Value> parsed = [reader parsedQueryValue:data];

doc = Doc(path, version, parsed,
hasMutations ? DocumentState::kLocalMutations : DocumentState::kSynced);
doc = Doc(path, version, std::move(parsed));
if (hasMutations) doc->SetHasLocalMutations();
}
return [[FIRDocumentSnapshot alloc] initWithFirestore:FSTTestFirestore().wrapped
return [[FIRDocumentSnapshot alloc] initWithFirestore:FSTTestFirestore()
documentKey:testutil::Key(path)
document:doc
fromCache:fromCache
Expand All @@ -114,35 +117,34 @@
NSDictionary<NSString *, NSDictionary<NSString *, id> *> *docsToAdd,
BOOL hasPendingWrites,
BOOL fromCache) {
FSTUserDataConverter *converter = FSTTestUserDataConverter();
FSTUserDataReader *reader = FSTTestUserDataReader();

SnapshotMetadata metadata(hasPendingWrites, fromCache);
DocumentSet oldDocuments(DocumentComparator::ByKey());
DocumentKeySet mutatedKeys;
for (NSString *key in oldDocs) {
FieldValue doc = [converter parsedQueryValue:oldDocs[key]];
Message<google_firestore_v1_Value> value = [reader parsedQueryValue:oldDocs[key]];
std::string documentKey = util::StringFormat("%s/%s", path, key);
oldDocuments = oldDocuments.insert(
Doc(documentKey, 1, doc,
hasPendingWrites ? DocumentState::kLocalMutations : DocumentState::kSynced));
MutableDocument doc = Doc(documentKey, 1, std::move(value));
if (hasPendingWrites) {
mutatedKeys = mutatedKeys.insert(testutil::Key(documentKey));
doc.SetHasLocalMutations();
}
oldDocuments = oldDocuments.insert(doc);
}

DocumentSet newDocuments = oldDocuments;
std::vector<DocumentViewChange> documentChanges;
for (NSString *key in docsToAdd) {
FieldValue doc = [converter parsedQueryValue:docsToAdd[key]];
Message<google_firestore_v1_Value> value = [reader parsedQueryValue:docsToAdd[key]];
std::string documentKey = util::StringFormat("%s/%s", path, key);
Document docToAdd =
Doc(documentKey, 1, doc,
hasPendingWrites ? DocumentState::kLocalMutations : DocumentState::kSynced);
newDocuments = newDocuments.insert(docToAdd);
documentChanges.emplace_back(docToAdd, DocumentViewChange::Type::Added);
MutableDocument doc = Doc(documentKey, 1, std::move(value));
documentChanges.emplace_back(doc, DocumentViewChange::Type::Added);
if (hasPendingWrites) {
mutatedKeys = mutatedKeys.insert(testutil::Key(documentKey));
doc.SetHasLocalMutations();
}
newDocuments = newDocuments.insert(doc);
}
ViewSnapshot viewSnapshot{Query(path),
newDocuments,
Expand Down
Loading