| Commit message (Collapse) | Author | Age |
| |
|
|
|
| |
Added a single, basic test as a motivator.
|
|
|
|
| |
(#1377)
|
| |
|
|
|
|
|
| |
This avoids a collision with the libprotobuf generated files.
Also removes the "well-known" cpp protos, relying on libprotobuf to supply these instead.
|
|
|
|
|
|
|
| |
Normally, this would be unexpected, as only a single entry in the Value
proto *should* be present. However, the proto docs state that parsers
should be able to handle repeated fields. (In the case of repeated
fields, the last one "wins".)
|
|
|
|
| |
... where neither 'found' nor 'missing' fields set.
|
| |
|
|
|
|
|
|
| |
Note that it isn't possible to *serialize* NoDocuments.
Still TODO:
- Error handling
|
|
|
|
|
|
| |
* Add HARD_ASSERT
* Use HARD_ASSERT
* Remove FIREBASE_ASSERT
* Remove StringPrintf
|
|
|
|
|
|
|
| |
* [De]serialize non-empty Document instances
Still TODO:
- NoDocument
- ErrorHandling
|
|
|
|
|
|
| |
* fix "target of using declaration conflicts with declaration already in scope"
* fix "call to implicitly-deleted copy constructor of *unique_ptr*"
|
|
|
|
| |
Mostly to make existing methods a bit more general to support followup
PR (which will allow encoding/decoding documents with contents.)
|
|
|
|
|
|
|
|
|
| |
* [De]serialize empty Document instances
Still TODO:
- non-empty
- NoDocument
- ErrorHandling
|
|
|
|
|
|
|
|
|
|
|
| |
Was using google_firestore_v1beta1_MapValue_FieldsEntry_key_tag to tag
the key/value pair. (But that tag should be used for the *key* of the
key/value pair, not the pair itself.) Switched to using
google_firestore_v1beta1_MapValue_fields_tag.
This previously worked anyways by coincidence. These two values happen
to be the same. (But it caused me all sorts of confusion as I adapted
this for Document contents.)
|
|
|
|
|
| |
Moved Tag, Reader, Writer from serializer.cc's anon namespace to firebase::firestore::nanopb
This should be bug-for-bug compatible. No changes were made to the moved methods.
|
| |
|
| |
|
|
|
|
|
| |
This is more interesting than the serializing case, as we should expect
to see occasional corruption of our input byte vector.
|
|
|
|
|
|
| |
Previously, the tests would compare serialization results against a
precomputed (via protoc) array of bytes. Now they serialize via our
nanopb based class and deserialize via libprotobuf (and vice versa) and
then ensure the result is the same as the input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add a .clang-tidy configuration for Firestore C++
* Fix clang-tidy warnings
* typedef -> using
* const ref + rvalue ref -> pass by value
* NULL -> nullptr
* remove useless default initializations
* remove useless const value-type parameter declarations (definitions
can still use them)
* use auto instead of repeating types in a cast
* Fix typos
* Address use of static method through instance warnings
* Address use after move warnings
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Deserializing not handled yet.
Note that the serializing case is fairly uninteresting, as assuming
valid input is passed in, there's no real reason why it should fail (and
if it does fail, it indicates a gross violation of our understanding of
the system.)
|
| |
|
|
|
|
|
|
|
| |
* Rename Writer::Encode* methods to Writer::Write*
* Rename: s/stream/writer/ (approximately)
but only where it applies to Writer (rather than pb_ostream_t).
|
|
|
|
|
|
|
|
|
|
| |
* Move creation of pb_ostream_t's into Writer
Writer now owns these structs
* Writer::FromBuffer -> Writer::Wrap
* add todo for possible future simplification.
|
|
|
|
| |
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.
|
|
|
|
| |
Wraps encoding of FieldValue "Objects" (i.e. map<string, FieldValue>'s)
and their entries (i.e. pair<string, FieldValue>'s)
|
|
|
| |
Wraps encoding nested messages.
|
|
|
| |
Uses a custom pb_ostream_t. Previously used a stack allocated 1k buffer.
|
|
|
| |
Wraps the string encode method.
|
|
|
| |
Wraps the varint based encode methods.
|
|
|
| |
These can (recursively) contain other FieldValues.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
Use remote/serializer placeholder class as a hook for the test to ensure
nanopb headers can be found, and test can be linked.
|