-
Notifications
You must be signed in to change notification settings - Fork 0
Expose transaction API #143
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #143 +/- ##
============================================
+ Coverage 94.33% 94.48% +0.14%
+ Complexity 530 522 -8
============================================
Files 64 65 +1
Lines 1925 1904 -21
Branches 102 96 -6
============================================
- Hits 1816 1799 -17
Misses 76 76
+ Partials 33 29 -4 |
|
@armiol, PTAL. |
|
@armiol, PTAL. |
armiol
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmdashenkov LGTM with two minor comments to address.
| return TimestampValue.of(fromProto(m.getWhenReceived())); | ||
| receivedAt("received_at", (m) -> { | ||
| Timestamp timestamp = m.getWhenReceived(); | ||
| long epochNanos = timestamp.getSeconds() * NANOS_PER_SECOND + timestamp.getNanos(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use Timestamps.toNanos(..).
| /** | ||
| * A Cloud Datastore transaction wrapper. | ||
| * | ||
| * @implNote The wrapper provides API for basic operations which can be done transactionally. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rephrase (as discussed) to emphasize on the Datastore limits.
This PR updates the API of the Cloud Datastore-based storage. In particular, we make it easier to work with transactions. The new methods of
TransactionWrappercover all the necessary database operations.Also, in this PR, we update the format of
InboxMessagestorage. Previously,InboxMessages had a Timestamp propertywhen_received. However, with the latest time-related changes in the framework, the precision of the Datastore Timestamp is now not enough for us. Thus, we introduce a new columnreceived_at, which contains the number of nanoseconds, elapsed since the Unix epoch start. Though nanoseconds are, strictly speaking, a lie, this is good enough for our technical purposes.As another side effect of the time-related changes, the standard idiom for querying entities by a time-based property has changed. Instead of passing an
equalsfilter, it is recommended toequalsfilter with a value rounded down to a whole microsecond;