Skip to content

Serialize (and deserialize) string values #864

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 3 commits into from
Feb 28, 2018

Conversation

rsgowman
Copy link
Member

No description provided.

Copy link
Contributor

@var-const var-const left a comment

Choose a reason for hiding this comment

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

LGTM with small nits.


// NB: future versions of nanopb read the remaining characters out of the
// substream (and return false if that fails) as an additional safety
// check within pb_clost_string_substream. Unfortunately, that's not present
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: s/pb_clost/pb_close

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

status = pb_encode_tag(&stream, PB_WT_STRING,
google_firestore_v1beta1_Value_string_value_tag);
if (!status) {
// TODO(rsgowman): figure out error handling
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional nit: maybe do a helper function like handle_error() { /* TODO */ abort(); } or validate_status(bool status, SomeType error) { /*TODO*/ if (!status) abort; } to avoid copying the same comment around? This presumes that error handling will be pretty similar across {en,de}coders.

Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than do all that refactoring, I'd probably be better off to just implement error handling; it really isn't going to be all that complicated. I'll issue a followup PR.

// TEXT_FORMAT_PROTO: 'string_value: "æ"'
{"æ", {0x8a, 0x01, 0x02, 0xc3, 0xa6}},
// TEXT_FORMAT_PROTO: 'string_value: "\0\ud7ff\ue000\uffff"'
// Some magic: Due to the unicode escapes (\u) and
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: feel free to disagree, but I don't think this is magic. It's valid to embed a universal character name inside a char string literal, it will map to several characters if necessary, so I'm not sure if there's any narrowing involved. Consider rephrasing to something like:

"Each one of the three embedded universal character names (\u-escaped) maps to three chars, so the total length of the string literal is 10 (ignoring the terminating null), and the resulting string literal is the same as '\0\xed\x9f\xbf\xee\x80\x80\xef\xbf\xbf'"

or similar.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like your phrasing better. (Done) The thing that confused me initially was the \0 prefix. I didn't look close enough to realize that's a null, rather than just another unicode escape character, and was surprised when my encoding function encoded 0 bytes. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yeah, std::string can contain embedded nulls, which can be a gotcha when using c_str.

Copy link
Member Author

Choose a reason for hiding this comment

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

In my case, it was actually the other way around. i.e. std::string("\0ABCDEFG") contains an empty string and doesn't have any embedded nulls in it. (The ctor stops processing the input char* as soon as it sees the null at position 0... unless you also indicate the size.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, that constructor presumes a null-terminated string, because there's no way to figure out the role of a given null. I had a funny quirk reimplementing some Objective C parsing in C++: when parsing an std::string, I had to make sure parsing stops upon encountering '\0' even if it comes before the last character in the string is reached, for consistency with existing behavior (this might be a little paranoid, though).

Copy link
Contributor

@zxu123 zxu123 left a comment

Choose a reason for hiding this comment

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

LGTM

// TEXT_FORMAT_PROTO: 'string_value: "abc def"'
{"abc def", {0x8a, 0x01, 0x07, 0x61, 0x62, 0x63, 0x20, 0x64, 0x65, 0x66}},
// TEXT_FORMAT_PROTO: 'string_value: "æ"'
{"æ", {0x8a, 0x01, 0x02, 0xc3, 0xa6}},
Copy link
Contributor

Choose a reason for hiding this comment

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

absolutely optional: Is it possible to use escape-sequence for the unicode character here instead of use that character directly? Assuming any modern editor/source-control-system supports unicode, there is no problem; so it is optional.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could; but OTOH, we've already got some test cases that use escape characters below. (More context: These test cases are taken from the other test suites, so my preference is to leave them as close as possible to the original.)

We could make an argument that this is redundant... but it's probably more trouble than it's worth to remove it across all platforms.

@rsgowman rsgowman requested a review from wilhuff February 27, 2018 22:04
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

Pretty much LGTM

@@ -18,6 +18,7 @@

#include <pb_decode.h>
#include <pb_encode.h>
#include <string>
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in a separate group from C headers (scripts/lint.sh should have flagged).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

lint.sh did not catch this (on either mac or linux)

abort();
}

pb_close_string_substream(stream, &substream);
Copy link
Contributor

Choose a reason for hiding this comment

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

I really hate to ask this question but does this need to be exception safe?

As it stands the string allocation could fail and we'd fail to undo this business here.

A simple way forward would be to move the allocation of result outside the group of C function calls. Secondarily though, there's the question of when we adopt error handling, is it a leak to fail to call this?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wilhuff I thought we just crash on exceptions and basically treat them as if they didn't exist?

Copy link
Contributor

Choose a reason for hiding this comment

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

In Objective-C, yes. Exceptions aren't expected to be handled and the runtime isn't capable of handling them without leaking anyway.

In general we don't throw exceptions there except for assertions and we expect those to crash the app.

In plain C++ that's not necessarily the case. Does anyone reasonably catch std::bad_alloc?

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean in C++. The style guide doesn't seem to distinguish between try and catch, so I presumed we don't use either. I'd be happy if that's not the case.

Copy link
Contributor

@var-const var-const Feb 27, 2018

Choose a reason for hiding this comment

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

Ah, I see, you mean user code should be able to catch the exception and Firestore shouldn't leak. If that's the case, sorry for misunderstanding.

Does anyone reasonably catch std::bad_alloc?

Can't think of how client code might reasonably expect to catch it from here.

Copy link
Member Author

@rsgowman rsgowman Feb 28, 2018

Choose a reason for hiding this comment

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

I really hate to ask this question

You've just kicked the hornet's nest. :(

A simple way forward would be to move the allocation of result outside the group of C function calls

I can't easily[1] do that. I need to wait until after pb_make_string_substream to know how large the string should be. (Well, I could allocate 0 bytes, and then extend it afterwards, but that doesn't avoid the problem.)

[1] - not technically correct. I could peak into the implementation details of pb_make_string_substream and simply do what it does, namely read the size required from the input stream. At which point, I've essentially just inlined the function.

does this need to be exception safe?

In this particular case, I believe the code is safe.

pb_make_string_substream/pb_close_string_substream don't actually allocate any memory. In particular, the close call just sets state on the stream (and newer versions of nanopb also ensure the substream is "consumed", i.e. the pointer is pointing to the end rather than somewhere in the middle.) So generally, there's no leak.

However, the stream may not be consistent, so recovering from bad_alloc and assuming the stream is fine would be incorrect. So as long as we don't catch the exception, we're ok (since by the time the exception goes up to the user, the stream has fallen off the stack. Also note that streams are typically stack allocated, so no free() calls are required.)

That said, these calls look like they could malloc or open() or otherwise consume resources that needs to be freed and, while nanopb clearly tries really hard to not malloc(), there's no guarantee it wouldn't change the implementation in the future to do this. (Side note: if you define PB_ENABLE_MALLOC=0 while compiling nanopb, it will ifdef out all the malloc calls. This reduces functionality, but a quick glance didn't turn up anything we actually use, so this might be worth investigating. Worst case: it would fail and therefore confirm that we are actually mallocing within nanopb.)

Does anyone reasonably catch std::bad_alloc?

Not generally on linux. These don't occur by default on linux due to it's over-committing memory model. (Instead, it relies on the infamous OOM killer to "take care" of things.) But I don't know about android/ios. (Probably developers still don't since there's usually not much that can usefully be done except crash.) OTOH, when people actually do catch bad_alloc, it's safe to assume that they really, really care about memory management, and would likely be disappointed (though not surprised) when a library they used didn't clean up properly due to this state.

So, options:

  1. noop. I think we're in a safe situation right now, even if bad_alloc is thrown. (More generally, we could always ignore bad_alloc and hope no one cares about this state.)
  2. catch bad_alloc (or ...). Then rethrow. (We don't use exceptions. But can we catch/rethrow them? I think we could add a catch block which would simply be not evaluated if -fno-exceptions is defined. In this situation, I think std::string would simply abort.)
  3. similar to 2; use char* buffer = malloc(size) and then check for null. (And then remember to free() after)
  4. similar to 2; but use #ifdef __cpp_exceptions.
  5. inline the nanopb calls. (Not a fan of this one.)
  6. wrap stuff like this in a c++ object with a dtor that handles cleanup. (i.e. RAII-ify nanopb)
  7. provide a different allocator to std::string which never throws, even when exceptions are enabled. (Haven't investigated this, but believe it to be feasible?)

Votes? (Keep in mind this will likely appear in many other places too, so vote twice if you feel we should do something different here than the general guidance.)

I like (1) for this specific case, and (2), (6) or (7) for the general case. (But (1) for the general case may be more pragmatic.)

Copy link
Contributor

Choose a reason for hiding this comment

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

Notes:

  1. Seems good in this instance
  2. is not viable:
    int main() {
      int* foo = nullptr;
      try {
        foo = new int(42);
      } catch (...) {
      }
      return *foo;
    }
    Fails to compile:
    # clang++ -fno-exceptions -std=c++11 test.cc
    test.cc:3:3: error: cannot use 'try' with exceptions disabled
      try {
      ^
    1 error generated.
    
  3. I'm not super happy about this as an approach just to be exception safe. Prefer (7) if at all.
  4. __cpp_exceptions is insufficient for all compilers. Thankfully ABSL_HAVE_EXCEPTIONS does the right thing. I'd consider this unusable if we had to do this in every function that could potentially throw though.
  5. Agreed
  6. For places it really matters and it's an error we're actually going to handle and continue processing then thisis the way to go. For nanopb specifically, I think any error returned here indicates we made a programming error so this should ultimately end up in an assertion failure.
  7. new (std::nothrow) char[bufsize] from #include <new>.

I'd articulate general principles:

  • In cases where we have heavy weight objects we need to remember to deallocate we should RAII just for our own sanity. At the very least with std::unique_ptr.
  • Avoid malloc/free unless specifically dealing with a C API that requires it (e.g. asprintf if we were crazy enough to use it).
  • Even still, we might consider using unique_ptr so we can't forget, e.g.
    auto buf = std::unique_ptr<char, decltype(free)*>(reinterpret_cast<char*>(malloc(42)), free);
  • We tolerate that libraries we use might throw but don't attempt to recover.
  • We don't throw our own C++ exceptions
  • If we could usefully recover wrap the invocation in a lambda and pass that to a helper that does the #ifdef magic. This will be an extremely high bar to get over and must demonstrably and meaningfully improve developer quality of life.

If we agree I'll chuck these I'll chuck these in our migration guide (plus your feedback of course).

Copy link
Contributor

Choose a reason for hiding this comment

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

If we're voting, I'd vote for 1 and 6, depending on the situation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Re (2): Darn. For some reason, I thought that worked. (Must've been confused.)

Yeah, everything else sgtm. I'll merge this PR shortly as is.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

abort();
}

pb_close_string_substream(stream, &substream);
Copy link
Contributor

Choose a reason for hiding this comment

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

Notes:

  1. Seems good in this instance
  2. is not viable:
    int main() {
      int* foo = nullptr;
      try {
        foo = new int(42);
      } catch (...) {
      }
      return *foo;
    }
    Fails to compile:
    # clang++ -fno-exceptions -std=c++11 test.cc
    test.cc:3:3: error: cannot use 'try' with exceptions disabled
      try {
      ^
    1 error generated.
    
  3. I'm not super happy about this as an approach just to be exception safe. Prefer (7) if at all.
  4. __cpp_exceptions is insufficient for all compilers. Thankfully ABSL_HAVE_EXCEPTIONS does the right thing. I'd consider this unusable if we had to do this in every function that could potentially throw though.
  5. Agreed
  6. For places it really matters and it's an error we're actually going to handle and continue processing then thisis the way to go. For nanopb specifically, I think any error returned here indicates we made a programming error so this should ultimately end up in an assertion failure.
  7. new (std::nothrow) char[bufsize] from #include <new>.

I'd articulate general principles:

  • In cases where we have heavy weight objects we need to remember to deallocate we should RAII just for our own sanity. At the very least with std::unique_ptr.
  • Avoid malloc/free unless specifically dealing with a C API that requires it (e.g. asprintf if we were crazy enough to use it).
  • Even still, we might consider using unique_ptr so we can't forget, e.g.
    auto buf = std::unique_ptr<char, decltype(free)*>(reinterpret_cast<char*>(malloc(42)), free);
  • We tolerate that libraries we use might throw but don't attempt to recover.
  • We don't throw our own C++ exceptions
  • If we could usefully recover wrap the invocation in a lambda and pass that to a helper that does the #ifdef magic. This will be an extremely high bar to get over and must demonstrably and meaningfully improve developer quality of life.

If we agree I'll chuck these I'll chuck these in our migration guide (plus your feedback of course).

@rsgowman rsgowman merged commit 9b5b4d8 into master Feb 28, 2018
@rsgowman rsgowman deleted the rsgowman/serialize_string2 branch February 28, 2018 20:32
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <[email protected]>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <[email protected]>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <[email protected]>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <[email protected]>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <[email protected]>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <[email protected]>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <[email protected]>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <[email protected]>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <[email protected]>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <[email protected]>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <[email protected]>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <[email protected]>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <[email protected]>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <[email protected]>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <[email protected]>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <[email protected]>

ORIGINAL_AUTHOR=Gil <[email protected]>
PiperOrigin-RevId: 188809445
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <[email protected]>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <[email protected]>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <[email protected]>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <[email protected]>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <[email protected]>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <[email protected]>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <[email protected]>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <[email protected]>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <[email protected]>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <[email protected]>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <[email protected]>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <[email protected]>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <[email protected]>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <[email protected]>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <[email protected]>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <[email protected]>

PiperOrigin-RevId: 188809445
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <[email protected]>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <[email protected]>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <[email protected]>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <[email protected]>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <[email protected]>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <[email protected]>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <[email protected]>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <[email protected]>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <[email protected]>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <[email protected]>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <[email protected]>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <[email protected]>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <[email protected]>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <[email protected]>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <[email protected]>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <[email protected]>

ORIGINAL_AUTHOR=Gil <[email protected]>
PiperOrigin-RevId: 188809445
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <rgowman>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <rgowman>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <rgowman>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <rgowman>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <zxu>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <rgowman>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <mcg>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <paulbeusterien>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <paulbeusterien>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <zxu>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <zxu>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <rgowman>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <chliang>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <rgowman>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <zxu>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <rgowman>

ORIGINAL_AUTHOR=Gil <[email protected]>
PiperOrigin-RevId: 188809445
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <rgowman>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <rgowman>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <rgowman>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <rgowman>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <zxu>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <rgowman>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <mcg>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <paulbeusterien>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <paulbeusterien>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <zxu>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <zxu>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <rgowman>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <chliang>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <rgowman>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <zxu>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <rgowman>

ORIGINAL_AUTHOR=Gil <[email protected]>
PiperOrigin-RevId: 188809445
zxu123 pushed a commit to zxu123/firebase-ios-sdk that referenced this pull request May 23, 2018
--
197713382 by zxu <zxu>:

Implement more on listener class and implement ListenerRegistration.

TESTED:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/testapp:android_testapp_test --config=android_x86 --define firebase_build=stable
blaze test //sensored/cpp:firestore_kokoro
blaze test //sensored/cpp:listener_registration_test
--
196551381 by zxu <zxu>:

Implement more on listener class and implement the DocumentReference::AddSnapshotListener.

Also added a few test case and fixed a bug in DocumentReferenceInternal.

ListenerRegistration will be implemented in subsequent CL.

TESTED:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/testapp:android_testapp_test --config=android_x86 --define firebase_build=stable
blaze test //sensored/cpp:firestore_kokoro
blaze test //sensored/cpp:firestore_test
--
196276752 by zxu <zxu>:

Implement the SnapshotMetadata with inline methods and (non-)Wrapper for Firestore C++.

TESTED:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/testapp:android_testapp_test --config=android_x86 --experimental_one_version_enforcement=warning
blaze test //sensored/cpp:firestore_kokoro
blaze test //sensored/cpp:firestore_test
--
195841793 by zxu <zxu>:

Implement the wrapper class for callback (EventListener).

People unlike huge CL. So sending this short one for review. In subsequent CLs, I'll do:
*   cache/uncache or the CppEventListener class and the wiring of native method;
*   actually using this to implement DocumentReference::AddSnapshotListener;
*   update the testapp to run android_test with callback.
--
194112388 by zxu <zxu>:

Add Android-Wrapper for DocumentReference's non-callback methods.

Tested:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/cpp:firestore_kokoro
blaze test //sensored/cpp:firestore_test
--
192445183 by zxu <zxu>:

Add Android-Wrapper for Firestore's remaining methods.
Tested:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/cpp:firestore_kokoro
blaze test //sensored/cpp:firestore_test
--
190986604 by mcg <mcg>:

Manually import the public portion of

  - 22c226a C++ migration: make Timestamp class a part of public API ... by Konstantin Varlamov <[email protected]>

Note that this only imports the header, which otherewise won't come over with a
regular copybara run because we're currently excluding the public headers from
the Firestore import with cl/188810622.

The .cc implementation of this will come over with a regular copybara import,
coming shortly.
--
189013767 by zxu <zxu>:

Add Android-Wrapper for Firestore's method that does not involve other Firestore types.
Tested:
blaze test //sensored/testapp:testapp_build_test
blaze test //sensored/testapp:testapp_build_test --config=android_x86
blaze test //sensored/cpp:firestore_kokoro
--
188809445 by mcg <mcg>:

Import of firebase-ios-sdk from Github.

  - 07f4695 Updates Changelog for 4.5.0 release (firebase#908) by Zsika Phillip <[email protected]>
  - 2b82a2e Allow serializing arbitrary length FieldValues (firebase#889) by rsgowman <rgowman>
  - 3e41f25 Fix test failures that occur during prod build (firebase#910) by rsgowman <rgowman>
  - f122cf7 Fix MutationQueue issue resulting in re-sending acknowled... by Michael Lehenbauer <[email protected]>
  - 7522314 Partial wrapping of pb_ostream_t (pt2) (firebase#903) by rsgowman <rgowman>
  - 0d3adb1 Partial wrapping of pb_ostream_t (pt1) (firebase#899) by rsgowman <rgowman>
  - e41f4b1 Merge Release 4.10.1 into Master (firebase#896) by zxu <zxu>
  - 2ae36f1 [De]Serialize FieldValue map_values ("Objects") (firebase#878) by rsgowman <rgowman>
  - 5930ad2 Factor out a universal build script (firebase#884) by Gil <mcg>
  - 8ef0f14 Adds Email link sign-in (firebase#882) by Paul Beusterien <paulbeusterien>
  - 0b8f216 Merge pull request firebase#880 from firebase/release-4.10.0 by Paul Beusterien <paulbeusterien>
  - 8311c64 port paths to FSTDocumentKey (firebase#877) by zxu <zxu>
  - 34ebf10 Add 10 second timeout waiting for connection before clien... by Michael Lehenbauer <[email protected]>
  - 1c40e7a add converters and port paths to FSTQuery (firebase#869) by zxu <zxu>
  - 9b5b4d8 Serialize (and deserialize) string values (firebase#864) by rsgowman <rgowman>
  - c6f73f7 Fix the issue completion handler is not triggered in subs... by Chen Liang <chliang>
  - 1ecf690 Add FieldValue.boolean_value() (firebase#862) by rsgowman <rgowman>
  - 3e7c062 replacing Auth by C++ auth implementation (firebase#802) by zxu <zxu>
  - 13aeb61 Eliminate TypedValue and serialize direct from FieldValue... by rsgowman <rgowman>
--
187049498 by mcg <mcg>:

Import of firebase-ios-sdk from Github.

  - f7d9f29 Fix lint warnings (firebase#840) by Gil <mcg>
  - b5c60ad Refactor [En|De]codeVarint to be symetric wrt tags (firebase#837) by rsgowman <rgowman>
  - ddc12c0 Merge pull request firebase#694 from morganchen12/auth-docs by Morgan Chen <[email protected]>
  - 442d46f Avoid warnings about failing to override a designated ini... by Gil <mcg>
  - 4dc63f8 Fix Firestore tests for M22 (firebase#834) by Gil <mcg>
  - 935f3ca  Avoid wrapping and rewrapping NSStrings when constructin... by Gil <mcg>
  - 6ce954a Serialize (and deserialize) int64 values (firebase#818) (firebase#829) by rsgowman <rgowman>
  - 41dcd4b Fix trivial mem leak in the test suite (firebase#828) by rsgowman <rgowman>
  - 50f9df9 Accept FIRTimestamp where NSDate is currently accepted as... by Konstantin Varlamov <[email protected]>
  - 67b068e Fix implicit retain self warnings (firebase#808) by rsgowman <rgowman>
  - 14ea068 Make FSTTimestamp into a public Firestore class (firebase#698) by Konstantin Varlamov <[email protected]>
  - de00de2 [En|De]codeUnsignedVarint -> [En|De]codeVarint (firebase#817) by rsgowman <rgowman>
  - 9bf73ab Fix two stream close issues (b/73167987, b/73382103). (firebase#8... by Michael Lehenbauer <[email protected]>
  - 7a4a2ea replacing FSTGetTokenResult by C++ Token implementation (... by zxu <zxu>
  - a9f3f35 Delete stale Firestore instances after FIRApp is deleted.... by Ryan Wilson <wilsonryan>
  - aa6f1ae Disable -Wrange-loop-analysis for abseil (firebase#807) by rsgowman <rgowman>
  - ef55eef Require official 1.4.0 for min CocoaPods version (firebase#806) by Paul Beusterien <paulbeusterien>
  - 7cddb97 Serialize (and deserialize) bool values (firebase#791) by rsgowman <rgowman>
  - 7a97f6c Enable -Wcomma for our build; disable it for abseil. (firebase#799) by rsgowman <rgowman>
  - 81ee594 DispatchQueue delayed callback improvements + testing (firebase#7... by Michael Lehenbauer <[email protected]>
  - fd9fd27 replacing Auth/FSTUser by C++ auth implementation (firebase#804) by zxu <zxu>
  - 6889850 Merge pull request firebase#801 from firebase/release-4.9.0 by Paul Beusterien <paulbeusterien>
  - e4be254 Fixed capitalization of init in test function. (firebase#797) by Ryan Wilson <wilsonryan>
  - 933be73 Improve documentation on auto-init property in FCM. (firebase#792) by Chen Liang <chliang>
  - 0f3c24b Actually ignore events on inactive streams, rather than j... by Greg Soltis <gsoltis>
  - fe19fca Serialize and deserialize null (firebase#783) by rsgowman <rgowman>
  - 95d0411 fix flaky test (firebase#788) by zxu <zxu>
  - b6613bd Cleaning up implicit retain for the RTDB and Storage by Sebastian Schmidt <mrschmidt>
  - 5f5f808 Keep track of number of queries in the query cache (firebase#776) by Greg Soltis <gsoltis>
  - c7c51a7 Fix double parsing on 32 bit devices. (firebase#787) by Ryan Wilson <wilsonryan>
  - 9504582 Port Firestore Document to C++ (firebase#777) by zxu <zxu>
  - adf9fb3 Update FieldValue of type Reference (firebase#775) by zxu <zxu>
  - 4afcfb1 Move to explicit nil check. (firebase#782) by Ryan Wilson <wilsonryan>
  - fd83e07 Strawman C++ API (firebase#763) by rsgowman <rgowman>
  - 8003348 C++ port: add C++ equivalent of FSTDocumentKey. (firebase#762) by Konstantin Varlamov <[email protected]>
  - 612d99c Fix Core CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF warnings (#... by Paul Beusterien <paulbeusterien>
  - bf45a15 port Firestore SnapshotVersion in C++ (firebase#767) by zxu <zxu>
  - d70c23e port Firestore Auth module in C++ (firebase#733) by zxu <zxu>
  - 633eb7b Let Travis run for `CMake` test and `lint.sh` (firebase#769) by zxu <zxu>
  - 274fe52 cmake build fixes (firebase#770) by rsgowman <rgowman>
--
184568931 by mcg <mcg>:

Import of firebase-ios-sdk from Github.

  - 32266c5 Make sure Firestore/core/include is in the podspec (firebase#748) by Gil <mcg>
  - 070c0ea Merge pull request firebase#746 from morganchen12/unguarded-block by Morgan Chen <[email protected]>
  - 13f572e Increase expectation timeout to 25 seconds. (firebase#744) by Michael Lehenbauer <[email protected]>
  - 47d81fd fix (firebase#739) by Chen Liang <chliang>
  - 515625c Remove predecessorKey,Object,Document, etc (firebase#735) by Gil <mcg>
  - ac30522 Start on ArraySortedMap in C++ (firebase#721) by Gil <mcg>
  - 729b8d1 Move all Firestore Objective-C to Objective-C++ (firebase#734) by Gil <mcg>
  - 693d064 Merge pull request firebase#732 from OleksiyA/FCM-subscribe-compl... by Oleksiy Ivanov <[email protected]>
  - 3cbdbf2 Schema migrations for LevelDB (firebase#728) by Greg Soltis <gsoltis>
  - 6474a82 Firestore DatabaseId in C++ (firebase#727) by zxu <zxu>
  - 05ef5ae Add absl_strings to firebase_firestore_util_test dependen... by rsgowman <rgowman>
  - 03a0069 Add changelog entry for my last PR (oops) and also add a ... by Michael Lehenbauer <[email protected]>
  - 5a280ca  Import iterator_adaptors from google3 (firebase#718) by Gil <mcg>
  - 63a380b Use fixed-sized types (firebase#719) by Gil <mcg>
  - 6dc1373 Version updates to 4.8.2 (firebase#722) by Paul Beusterien <paulbeusterien>
  - a74d39f Fix a number of c++ build errors (firebase#715) by rsgowman <rgowman>
  - cceeec3 travis: check for copyright in sources (firebase#717) by Paul Beusterien <paulbeusterien>
  - 4d7c973 Fix b/72502745: OnlineState changes cause limbo document ... by Michael Lehenbauer <[email protected]>
  - af6976a normalize and port the rest of Firebase/Port code (firebase#713) by zxu <zxu>
  - 7226b4a port TargetIdGenerator to iOS (firebase#709) by zxu <zxu>
  - 5306474 adding unit test for auto init enable function (firebase#710) by Chen Liang <chliang>
  - 821fb90 implement `TargetIdGenerator` in C++ for Firestore (firebase#701) by zxu <zxu>
  - 5fdda3f normalize string_util (firebase#708) by zxu <zxu>
  - 15a2926 Update CHANGELOG for M21.1 release (firebase#679) by Ryan Wilson <wilsonryan>
  - f027214 Fix incorrect deprecation message (firebase#688) by Iulian Onofrei <[email protected]>
  - bfa0e40 Implement the rest of FieldValue types for C++ (firebase#687) by zxu <zxu>
  - 1f77212 Properly publish Abseil sources as a part of the podspec ... by Gil <mcg>

ORIGINAL_AUTHOR=Firebase <firebase-noreply>
PiperOrigin-RevId: 197713382
minafarid pushed a commit to minafarid/firebase-ios-sdk that referenced this pull request Jun 6, 2018
@firebase firebase locked and limited conversation to collaborators Nov 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants