Skip to content

BundleSerializer changes for Protobuf migration #7999

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

Conversation

schmidt-sebastian
Copy link
Contributor

This is part of #7904. It will break the feature branch, but I am planning to send out small reviewable chunks with an end goal of a feature branch that passes CI.

This PR changes the Bundle serializer to serialize into NanoPB.

@google-cla google-cla bot added the cla: yes label Apr 28, 2021
@google-oss-bot
Copy link

1 Warning
⚠️ Did you forget to add a changelog entry? (Add #no-changelog to the PR description to silence this warning.)

Generated by 🚫 Danger

@@ -522,13 +526,13 @@ BundledQuery BundleSerializer::DecodeBundledQuery(

auto start_at_bound = DecodeBound(reader, structured_query, "startAt");
std::shared_ptr<Bound> start_at;
if (!start_at_bound.position().empty()) {
if (start_at_bound.position().values_count) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, it is probably just me, but i always found adding a > 0 helps readability..optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


return rpc_serializer_.DecodeReference(&reader, ref_string);
google_firestore_v1_ArrayValue array_value{};
SetRepeatedField(&array_value.values, &array_value.values_count, values,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the behavior changed..there was an early exit if decoding a value failed. But maybe it does not matter..if there is no easy way to bring that back, I am OK to leave it as it is now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It not as easy anymore to do the validation since I am generally just passing through the protos. I could handle bundles differently, but for now I prefer to keep the current handling (and show a warning in DocumentSnapshot.data())

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Apr 28, 2021
@schmidt-sebastian schmidt-sebastian force-pushed the mrschmidt/bundleserializer branch from 40321d2 to c6a9340 Compare April 29, 2021 00:01
@schmidt-sebastian schmidt-sebastian merged commit 66bde46 into mrschmidt/mutabledocuments Apr 29, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/bundleserializer branch April 29, 2021 00:04
@firebase firebase locked and limited conversation to collaborators May 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants