Skip to content

Commit ff5e397

Browse files
authoredMay 20, 2024··
feat: New PropertyMask field which allows partial commits, lookups, and query results (#1455)
* feat: New PropertyMask field which allows partial commits, lookups, and query results PiperOrigin-RevId: 635449160 Source-Link: googleapis/googleapis@dde0ec1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8caa60d9aea82964a19cdf8faf91384911db8bdd Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGNhYTYwZDlhZWE4Mjk2NGExOWNkZjhmYWY5MTM4NDkxMWRiOGJkZCJ9 * 🦉 Updates from OwlBot post-processor 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 c3c1317 commit ff5e397

File tree

10 files changed

+2346
-156
lines changed

10 files changed

+2346
-156
lines changed
 

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/DatastoreProto.java

+165-145
Large diffs are not rendered by default.

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequest.java

+329
Large diffs are not rendered by default.

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/LookupRequestOrBuilder.java

+50
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,54 @@ public interface LookupRequestOrBuilder
170170
* </code>
171171
*/
172172
com.google.datastore.v1.KeyOrBuilder getKeysOrBuilder(int index);
173+
174+
/**
175+
*
176+
*
177+
* <pre>
178+
* The properties to return. Defaults to returning all properties.
179+
*
180+
* If this field is set and an entity has a property not referenced in the
181+
* mask, it will be absent from [LookupResponse.found.entity.properties][].
182+
*
183+
* The entity's key is always returned.
184+
* </pre>
185+
*
186+
* <code>.google.datastore.v1.PropertyMask property_mask = 5;</code>
187+
*
188+
* @return Whether the propertyMask field is set.
189+
*/
190+
boolean hasPropertyMask();
191+
/**
192+
*
193+
*
194+
* <pre>
195+
* The properties to return. Defaults to returning all properties.
196+
*
197+
* If this field is set and an entity has a property not referenced in the
198+
* mask, it will be absent from [LookupResponse.found.entity.properties][].
199+
*
200+
* The entity's key is always returned.
201+
* </pre>
202+
*
203+
* <code>.google.datastore.v1.PropertyMask property_mask = 5;</code>
204+
*
205+
* @return The propertyMask.
206+
*/
207+
com.google.datastore.v1.PropertyMask getPropertyMask();
208+
/**
209+
*
210+
*
211+
* <pre>
212+
* The properties to return. Defaults to returning all properties.
213+
*
214+
* If this field is set and an entity has a property not referenced in the
215+
* mask, it will be absent from [LookupResponse.found.entity.properties][].
216+
*
217+
* The entity's key is always returned.
218+
* </pre>
219+
*
220+
* <code>.google.datastore.v1.PropertyMask property_mask = 5;</code>
221+
*/
222+
com.google.datastore.v1.PropertyMaskOrBuilder getPropertyMaskOrBuilder();
173223
}

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/Mutation.java

+365-1
Large diffs are not rendered by default.

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/MutationOrBuilder.java

+56
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,62 @@ public interface MutationOrBuilder
246246
*/
247247
com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder();
248248

249+
/**
250+
*
251+
*
252+
* <pre>
253+
* The properties to write in this mutation.
254+
* None of the properties in the mask may have a reserved name, except for
255+
* `__key__`.
256+
* This field is ignored for `delete`.
257+
*
258+
* If the entity already exists, only properties referenced in the mask are
259+
* updated, others are left untouched.
260+
* Properties referenced in the mask but not in the entity are deleted.
261+
* </pre>
262+
*
263+
* <code>.google.datastore.v1.PropertyMask property_mask = 9;</code>
264+
*
265+
* @return Whether the propertyMask field is set.
266+
*/
267+
boolean hasPropertyMask();
268+
/**
269+
*
270+
*
271+
* <pre>
272+
* The properties to write in this mutation.
273+
* None of the properties in the mask may have a reserved name, except for
274+
* `__key__`.
275+
* This field is ignored for `delete`.
276+
*
277+
* If the entity already exists, only properties referenced in the mask are
278+
* updated, others are left untouched.
279+
* Properties referenced in the mask but not in the entity are deleted.
280+
* </pre>
281+
*
282+
* <code>.google.datastore.v1.PropertyMask property_mask = 9;</code>
283+
*
284+
* @return The propertyMask.
285+
*/
286+
com.google.datastore.v1.PropertyMask getPropertyMask();
287+
/**
288+
*
289+
*
290+
* <pre>
291+
* The properties to write in this mutation.
292+
* None of the properties in the mask may have a reserved name, except for
293+
* `__key__`.
294+
* This field is ignored for `delete`.
295+
*
296+
* If the entity already exists, only properties referenced in the mask are
297+
* updated, others are left untouched.
298+
* Properties referenced in the mask but not in the entity are deleted.
299+
* </pre>
300+
*
301+
* <code>.google.datastore.v1.PropertyMask property_mask = 9;</code>
302+
*/
303+
com.google.datastore.v1.PropertyMaskOrBuilder getPropertyMaskOrBuilder();
304+
249305
com.google.datastore.v1.Mutation.OperationCase getOperationCase();
250306

251307
com.google.datastore.v1.Mutation.ConflictDetectionStrategyCase getConflictDetectionStrategyCase();

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/PropertyMask.java

+848
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
// Generated by the protocol buffer compiler. DO NOT EDIT!
17+
// source: google/datastore/v1/datastore.proto
18+
19+
// Protobuf Java Version: 3.25.3
20+
package com.google.datastore.v1;
21+
22+
public interface PropertyMaskOrBuilder
23+
extends
24+
// @@protoc_insertion_point(interface_extends:google.datastore.v1.PropertyMask)
25+
com.google.protobuf.MessageOrBuilder {
26+
27+
/**
28+
*
29+
*
30+
* <pre>
31+
* The paths to the properties covered by this mask.
32+
*
33+
* A path is a list of property names separated by dots (`.`), for example
34+
* `foo.bar` means the property `bar` inside the entity property `foo` inside
35+
* the entity associated with this path.
36+
*
37+
* If a property name contains a dot `.` or a backslash `&#92;`, then that
38+
* name must be escaped.
39+
*
40+
* A path must not be empty, and may not reference a value inside an
41+
* [array value][google.datastore.v1.Value.array_value].
42+
* </pre>
43+
*
44+
* <code>repeated string paths = 1;</code>
45+
*
46+
* @return A list containing the paths.
47+
*/
48+
java.util.List<java.lang.String> getPathsList();
49+
/**
50+
*
51+
*
52+
* <pre>
53+
* The paths to the properties covered by this mask.
54+
*
55+
* A path is a list of property names separated by dots (`.`), for example
56+
* `foo.bar` means the property `bar` inside the entity property `foo` inside
57+
* the entity associated with this path.
58+
*
59+
* If a property name contains a dot `.` or a backslash `&#92;`, then that
60+
* name must be escaped.
61+
*
62+
* A path must not be empty, and may not reference a value inside an
63+
* [array value][google.datastore.v1.Value.array_value].
64+
* </pre>
65+
*
66+
* <code>repeated string paths = 1;</code>
67+
*
68+
* @return The count of paths.
69+
*/
70+
int getPathsCount();
71+
/**
72+
*
73+
*
74+
* <pre>
75+
* The paths to the properties covered by this mask.
76+
*
77+
* A path is a list of property names separated by dots (`.`), for example
78+
* `foo.bar` means the property `bar` inside the entity property `foo` inside
79+
* the entity associated with this path.
80+
*
81+
* If a property name contains a dot `.` or a backslash `&#92;`, then that
82+
* name must be escaped.
83+
*
84+
* A path must not be empty, and may not reference a value inside an
85+
* [array value][google.datastore.v1.Value.array_value].
86+
* </pre>
87+
*
88+
* <code>repeated string paths = 1;</code>
89+
*
90+
* @param index The index of the element to return.
91+
* @return The paths at the given index.
92+
*/
93+
java.lang.String getPaths(int index);
94+
/**
95+
*
96+
*
97+
* <pre>
98+
* The paths to the properties covered by this mask.
99+
*
100+
* A path is a list of property names separated by dots (`.`), for example
101+
* `foo.bar` means the property `bar` inside the entity property `foo` inside
102+
* the entity associated with this path.
103+
*
104+
* If a property name contains a dot `.` or a backslash `&#92;`, then that
105+
* name must be escaped.
106+
*
107+
* A path must not be empty, and may not reference a value inside an
108+
* [array value][google.datastore.v1.Value.array_value].
109+
* </pre>
110+
*
111+
* <code>repeated string paths = 1;</code>
112+
*
113+
* @param index The index of the value to return.
114+
* @return The bytes of the paths at the given index.
115+
*/
116+
com.google.protobuf.ByteString getPathsBytes(int index);
117+
}

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequest.java

+327-10
Large diffs are not rendered by default.

‎proto-google-cloud-datastore-v1/src/main/java/com/google/datastore/v1/RunQueryRequestOrBuilder.java

+47
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,53 @@ public interface RunQueryRequestOrBuilder
229229
*/
230230
com.google.datastore.v1.GqlQueryOrBuilder getGqlQueryOrBuilder();
231231

232+
/**
233+
*
234+
*
235+
* <pre>
236+
* The properties to return.
237+
* This field must not be set for a projection query.
238+
*
239+
* See
240+
* [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
241+
* </pre>
242+
*
243+
* <code>.google.datastore.v1.PropertyMask property_mask = 10;</code>
244+
*
245+
* @return Whether the propertyMask field is set.
246+
*/
247+
boolean hasPropertyMask();
248+
/**
249+
*
250+
*
251+
* <pre>
252+
* The properties to return.
253+
* This field must not be set for a projection query.
254+
*
255+
* See
256+
* [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
257+
* </pre>
258+
*
259+
* <code>.google.datastore.v1.PropertyMask property_mask = 10;</code>
260+
*
261+
* @return The propertyMask.
262+
*/
263+
com.google.datastore.v1.PropertyMask getPropertyMask();
264+
/**
265+
*
266+
*
267+
* <pre>
268+
* The properties to return.
269+
* This field must not be set for a projection query.
270+
*
271+
* See
272+
* [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
273+
* </pre>
274+
*
275+
* <code>.google.datastore.v1.PropertyMask property_mask = 10;</code>
276+
*/
277+
com.google.datastore.v1.PropertyMaskOrBuilder getPropertyMaskOrBuilder();
278+
232279
/**
233280
*
234281
*

‎proto-google-cloud-datastore-v1/src/main/proto/google/datastore/v1/datastore.proto

+42
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ message LookupRequest {
173173

174174
// Required. Keys of entities to look up.
175175
repeated Key keys = 3 [(google.api.field_behavior) = REQUIRED];
176+
177+
// The properties to return. Defaults to returning all properties.
178+
//
179+
// If this field is set and an entity has a property not referenced in the
180+
// mask, it will be absent from [LookupResponse.found.entity.properties][].
181+
//
182+
// The entity's key is always returned.
183+
PropertyMask property_mask = 5;
176184
}
177185

178186
// The response for [Datastore.Lookup][google.datastore.v1.Datastore.Lookup].
@@ -234,6 +242,13 @@ message RunQueryRequest {
234242
GqlQuery gql_query = 7;
235243
}
236244

245+
// The properties to return.
246+
// This field must not be set for a projection query.
247+
//
248+
// See
249+
// [LookupRequest.property_mask][google.datastore.v1.LookupRequest.property_mask].
250+
PropertyMask property_mask = 10;
251+
237252
// Optional. Explain options for the query. If set, additional query
238253
// statistics will be returned. If not, only query results will be returned.
239254
ExplainOptions explain_options = 12 [(google.api.field_behavior) = OPTIONAL];
@@ -526,6 +541,16 @@ message Mutation {
526541
// mutation conflicts.
527542
google.protobuf.Timestamp update_time = 11;
528543
}
544+
545+
// The properties to write in this mutation.
546+
// None of the properties in the mask may have a reserved name, except for
547+
// `__key__`.
548+
// This field is ignored for `delete`.
549+
//
550+
// If the entity already exists, only properties referenced in the mask are
551+
// updated, others are left untouched.
552+
// Properties referenced in the mask but not in the entity are deleted.
553+
PropertyMask property_mask = 9;
529554
}
530555

531556
// The result of applying a mutation.
@@ -555,6 +580,23 @@ message MutationResult {
555580
bool conflict_detected = 5;
556581
}
557582

583+
// The set of arbitrarily nested property paths used to restrict an operation to
584+
// only a subset of properties in an entity.
585+
message PropertyMask {
586+
// The paths to the properties covered by this mask.
587+
//
588+
// A path is a list of property names separated by dots (`.`), for example
589+
// `foo.bar` means the property `bar` inside the entity property `foo` inside
590+
// the entity associated with this path.
591+
//
592+
// If a property name contains a dot `.` or a backslash `\`, then that
593+
// name must be escaped.
594+
//
595+
// A path must not be empty, and may not reference a value inside an
596+
// [array value][google.datastore.v1.Value.array_value].
597+
repeated string paths = 1;
598+
}
599+
558600
// The options shared by read requests.
559601
message ReadOptions {
560602
// The possible values for read consistencies.

0 commit comments

Comments
 (0)
Please sign in to comment.