feat(firestore): add BSONTimestamp support - #18390
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the BSONTimestamp class to represent BSON Timestamp containers for Firestore operation log entries, complete with validation, signed-to-unsigned conversion, and comprehensive unit and system tests. The review feedback points out an inconsistency in the validation error message, which states the value must be between 0 and 4294967295, even though negative signed 32-bit integers are accepted and converted. A code suggestion is provided to simplify the validation logic and make the error message accurate.
d023275 to
07ee207
Compare
3433917 to
e2483dc
Compare
e2483dc to
c216bc2
Compare
c216bc2 to
93363ca
Compare
d9a766f to
a7196a4
Compare
a7196a4 to
e7103a0
Compare
f15adf5 to
518b452
Compare
6cdffad to
2c2f615
Compare
2c2f615 to
c8959bf
Compare
c8959bf to
770f47d
Compare
770f47d to
e612561
Compare
e612561 to
f60d61d
Compare
f60d61d to
959e215
Compare
|
|
||
| Args: | ||
| seconds (int): Seconds count. | ||
| increment (int): Increment/ordinal. |
There was a problem hiding this comment.
nit: it's not clear to me what increment means here. But I tried looking at other docs, and it doesn't seem well defined there either. Maybe this is more clear to the intended user
959e215 to
cb4fa7a
Compare
cb4fa7a to
0164226
Compare
This PR adds support for
BSONTimestampin the Firestore Python SDK according to the official Firestore BSON specification.BSONTimestamprepresents an internal BSON operation log timestamp containing a 32-bit unsignedsecondscount and a 32-bit unsignedincrementcounter.BSONTimestampContainer Class: ImplementsBSONTimestamp(_BSONType)ingoogle.cloud.firestore_v1.bson, wrappingsecondsandincrementvalues.val % (1 << 32)(e.g.-1➔4,294,967,295)._to_map_value): Serializes to{"__request_timestamp__": {"seconds": self._seconds, "increment": self._increment}}.TypeError, and rejects values outside theValueError.BSONTimestampingoogle.cloud.firestoreandgoogle.cloud.firestore_v1, and updated.librarian/generator-input/client-post-processing/firestore-integration.yaml.Fixes b/562193816 🦕