Skip to content

Commit aef00f8

Browse files
feat: expose new read_time API fields, currently only available in private preview (#932)
PiperOrigin-RevId: 440914241 Source-Link: googleapis/googleapis@0ed730f Source-Link: googleapis/googleapis-gen@b2e5ae9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJlNWFlOTdmZDI0ZjY0YWYwZmVmMTk5OWRhZDE0OTQ1ZmRjMzY2MyJ9 See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 73f42c7 commit aef00f8

File tree

5 files changed

+378
-14
lines changed

5 files changed

+378
-14
lines changed

protos/google/datastore/v1/datastore.proto

+26-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121
import "google/api/field_behavior.proto";
2222
import "google/datastore/v1/entity.proto";
2323
import "google/datastore/v1/query.proto";
24+
import "google/protobuf/timestamp.proto";
2425

2526
option csharp_namespace = "Google.Cloud.Datastore.V1";
2627
option go_package = "google.golang.org/genproto/googleapis/datastore/v1;datastore";
@@ -138,6 +139,9 @@ message LookupResponse {
138139
// order of results in this field is undefined and has no relation to the
139140
// order of the keys in the input.
140141
repeated Key deferred = 3;
142+
143+
// The time at which these entities were read or found missing.
144+
google.protobuf.Timestamp read_time = 7;
141145
}
142146

143147
// The request for [Datastore.RunQuery][google.datastore.v1.Datastore.RunQuery].
@@ -259,6 +263,9 @@ message CommitResponse {
259263
// The number of index entries updated during the commit, or zero if none were
260264
// updated.
261265
int32 index_updates = 4;
266+
267+
// The transaction commit timestamp. Not set for non-transactional commits.
268+
google.protobuf.Timestamp commit_time = 8;
262269
}
263270

264271
// The request for [Datastore.AllocateIds][google.datastore.v1.Datastore.AllocateIds].
@@ -332,6 +339,11 @@ message Mutation {
332339
// to. If this does not match the current version on the server, the
333340
// mutation conflicts.
334341
int64 base_version = 8;
342+
343+
// The update time of the entity that this mutation is being applied
344+
// to. If this does not match the current update time on the server, the
345+
// mutation conflicts.
346+
google.protobuf.Timestamp update_time = 11;
335347
}
336348
}
337349

@@ -348,6 +360,12 @@ message MutationResult {
348360
// than the version of any possible future entity.
349361
int64 version = 4;
350362

363+
// The update time of the entity on the server after processing the mutation.
364+
// If the mutation doesn't change anything on the server, then the timestamp
365+
// will be the update timestamp of the current entity. This field will not be
366+
// set after a 'delete'.
367+
google.protobuf.Timestamp update_time = 6;
368+
351369
// Whether a conflict was detected for this mutation. Always false when a
352370
// conflict detection strategy field is not set in the mutation.
353371
bool conflict_detected = 5;
@@ -386,6 +404,11 @@ message ReadOptions {
386404
// transaction identifier is returned by a call to
387405
// [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction].
388406
bytes transaction = 2;
407+
408+
// Reads entities as they were at the given time. This may not be older
409+
// than 270 seconds. This value is only supported for Cloud Firestore in
410+
// Datastore mode.
411+
google.protobuf.Timestamp read_time = 4;
389412
}
390413
}
391414

@@ -403,7 +426,9 @@ message TransactionOptions {
403426

404427
// Options specific to read-only transactions.
405428
message ReadOnly {
406-
429+
// Reads entities at the given time.
430+
// This may not be older than 60 seconds.
431+
google.protobuf.Timestamp read_time = 1;
407432
}
408433

409434
// The `mode` of the transaction, indicating whether write operations are

protos/google/datastore/v1/query.proto

+19
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.datastore.v1;
1818

1919
import "google/datastore/v1/entity.proto";
20+
import "google/protobuf/timestamp.proto";
2021
import "google/protobuf/wrappers.proto";
2122

2223
option csharp_namespace = "Google.Cloud.Datastore.V1";
@@ -62,6 +63,12 @@ message EntityResult {
6263
// is always set except for eventually consistent reads.
6364
int64 version = 4;
6465

66+
// The time at which the entity was last changed.
67+
// This field is set for [`FULL`][google.datastore.v1.EntityResult.ResultType.FULL] entity
68+
// results.
69+
// If this entity is missing, this field will not be set.
70+
google.protobuf.Timestamp update_time = 5;
71+
6572
// A cursor that points to the position after the result entity.
6673
// Set only when the `EntityResult` is part of a `QueryResultBatch` message.
6774
bytes cursor = 3;
@@ -353,4 +360,16 @@ message QueryResultBatch {
353360
// is valid for all preceding batches.
354361
// The value will be zero for eventually consistent queries.
355362
int64 snapshot_version = 7;
363+
364+
// Read timestamp this batch was returned from.
365+
// This applies to the range of results from the query's `start_cursor` (or
366+
// the beginning of the query if no cursor was given) to this batch's
367+
// `end_cursor` (not the query's `end_cursor`).
368+
//
369+
// In a single transaction, subsequent query result batches for the same query
370+
// can have a greater timestamp. Each batch's read timestamp
371+
// is valid for all preceding batches.
372+
// This value will not be set for eventually consistent queries in Cloud
373+
// Datastore.
374+
google.protobuf.Timestamp read_time = 8;
356375
}

protos/protos.d.ts

+50-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)