@@ -44,6 +44,24 @@ public interface Datastore extends Service<DatastoreOptions>, DatastoreReaderWri
4444 */
4545 Transaction newTransaction ();
4646
47+ /**
48+ * Returns a new Datastore transaction with specified {@link DatastoreExecutionOptions}.
49+ *
50+ * @throws DatastoreException upon failure
51+ */
52+ @ BetaApi
53+ Transaction newTransaction (DatastoreExecutionOptions executionOptions );
54+
55+ /**
56+ * Returns a new Datastore transaction with specified {@link TransactionOptions} and {@link
57+ * DatastoreExecutionOptions}.
58+ *
59+ * @throws DatastoreException upon failure
60+ */
61+ @ BetaApi
62+ Transaction newTransaction (
63+ TransactionOptions options , DatastoreExecutionOptions executionOptions );
64+
4765 /**
4866 * A callback for running with a transactional {@link
4967 * com.google.cloud.datastore.DatastoreReaderWriter}. The associated transaction will be committed
@@ -179,6 +197,15 @@ interface TransactionCallable<T> {
179197 */
180198 List <Key > allocateId (IncompleteKey ... keys );
181199
200+ /**
201+ * Returns a list of keys using the allocated ids with specified {@link
202+ * DatastoreExecutionOptions}.
203+ *
204+ * @throws DatastoreException upon failure
205+ */
206+ @ BetaApi
207+ List <Key > allocateId (List <IncompleteKey > keys , DatastoreExecutionOptions executionOptions );
208+
182209 /**
183210 * Reserve one or more keys, preventing them from being automatically allocated by Datastore.
184211 *
@@ -196,6 +223,14 @@ interface TransactionCallable<T> {
196223 */
197224 List <Key > reserveIds (Key ... keys );
198225
226+ /**
227+ * Reserve one or more keys with specified {@link DatastoreExecutionOptions}.
228+ *
229+ * @throws DatastoreException upon failure
230+ */
231+ @ BetaApi
232+ List <Key > reserveIds (List <Key > keys , DatastoreExecutionOptions executionOptions );
233+
199234 /**
200235 * {@inheritDoc}
201236 *
@@ -226,6 +261,16 @@ interface TransactionCallable<T> {
226261 @ Override
227262 Entity add (FullEntity <?> entity );
228263
264+ /**
265+ * Datastore add operation: inserts the provided entity with specified {@link
266+ * DatastoreExecutionOptions}. This method will automatically allocate an id if necessary.
267+ *
268+ * @throws DatastoreException upon failure
269+ * @throws IllegalArgumentException if the given entity is missing a key
270+ */
271+ @ BetaApi
272+ Entity add (FullEntity <?> entity , DatastoreExecutionOptions executionOptions );
273+
229274 /**
230275 * {@inheritDoc}
231276 *
@@ -264,6 +309,17 @@ interface TransactionCallable<T> {
264309 @ Override
265310 List <Entity > add (FullEntity <?>... entities );
266311
312+ /**
313+ * Datastore add operation: inserts the provided entities with specified {@link
314+ * DatastoreExecutionOptions}. This method will automatically allocate id for any entity with an
315+ * incomplete key.
316+ *
317+ * @throws DatastoreException upon failure
318+ * @throws IllegalArgumentException if any of the given entities is missing a key
319+ */
320+ @ BetaApi
321+ List <Entity > add (List <FullEntity <?>> entities , DatastoreExecutionOptions executionOptions );
322+
267323 /**
268324 * {@inheritDoc}
269325 *
@@ -290,6 +346,15 @@ interface TransactionCallable<T> {
290346 @ Override
291347 void update (Entity ... entities );
292348
349+ /**
350+ * A Datastore update operation with specified {@link DatastoreExecutionOptions}. The operation
351+ * will fail if an entity with the same key does not already exist.
352+ *
353+ * @throws DatastoreException upon failure
354+ */
355+ @ BetaApi
356+ void update (List <Entity > entities , DatastoreExecutionOptions executionOptions );
357+
293358 /**
294359 * {@inheritDoc}
295360 *
@@ -309,31 +374,16 @@ interface TransactionCallable<T> {
309374 @ Override
310375 Entity put (FullEntity <?> entity );
311376
377+ @ Override
378+ List <Entity > put (FullEntity <?>... entities );
379+
312380 /**
313- * {@inheritDoc}
314- *
315- * <p>Example of putting multiple entities.
316- *
317- * <pre>{@code
318- * String keyName1 = "my_key_name1";
319- * String keyName2 = "my_key_name2";
320- * Key key1 = datastore.newKeyFactory().setKind("MyKind").newKey(keyName1);
321- * Entity.Builder entityBuilder1 = Entity.newBuilder(key1);
322- * entityBuilder1.set("propertyName", "value1");
323- * Entity entity1 = entityBuilder1.build();
324- *
325- * Key key2 = datastore.newKeyFactory().setKind("MyKind").newKey(keyName2);
326- * Entity.Builder entityBuilder2 = Entity.newBuilder(key2);
327- * entityBuilder2.set("propertyName", "value2");
328- * Entity entity2 = entityBuilder2.build();
329- *
330- * datastore.put(entity1, entity2);
331- * }</pre>
381+ * {@inheritDoc} with specified {@link DatastoreExecutionOptions}.
332382 *
333383 * @throws DatastoreException upon failure
334384 */
335- @ Override
336- List <Entity > put (FullEntity <?>... entities );
385+ @ BetaApi
386+ List <Entity > put (List < FullEntity <?>> entities , DatastoreExecutionOptions executionOptions );
337387
338388 /**
339389 * {@inheritDoc}
@@ -353,6 +403,14 @@ interface TransactionCallable<T> {
353403 @ Override
354404 void delete (Key ... keys );
355405
406+ /**
407+ * A datastore delete operation with specified {@link DatastoreExecutionOptions}.
408+ *
409+ * @throws DatastoreException upon failure
410+ */
411+ @ BetaApi
412+ void delete (List <Key > keys , DatastoreExecutionOptions executionOptions );
413+
356414 /**
357415 * Returns a new KeyFactory for this service
358416 *
@@ -381,6 +439,15 @@ interface TransactionCallable<T> {
381439 */
382440 Entity get (Key key , ReadOption ... options );
383441
442+ /**
443+ * Returns an {@link Entity} for the given {@link Key} with specified {@link
444+ * DatastoreExecutionOptions}.
445+ *
446+ * @throws DatastoreException upon failure
447+ */
448+ @ BetaApi
449+ Entity get (Key key , DatastoreExecutionOptions executionOptions );
450+
384451 /**
385452 * Returns an {@link Entity} for each given {@link Key} that exists in the Datastore. The order of
386453 * the result is unspecified. Results are loaded lazily, so it is possible to get a {@code
@@ -409,6 +476,15 @@ interface TransactionCallable<T> {
409476 */
410477 Iterator <Entity > get (Iterable <Key > keys , ReadOption ... options );
411478
479+ /**
480+ * Returns an {@link Entity} for each given {@link Key} with specified {@link
481+ * DatastoreExecutionOptions}.
482+ *
483+ * @throws DatastoreException upon failure
484+ */
485+ @ BetaApi
486+ Iterator <Entity > get (Iterable <Key > keys , DatastoreExecutionOptions executionOptions );
487+
412488 /**
413489 * Returns a list with a value for each given key (ordered by input). {@code null} values are
414490 * returned for nonexistent keys. When possible prefer using {@link #get(Key...)} to avoid eagerly
@@ -430,6 +506,13 @@ interface TransactionCallable<T> {
430506 */
431507 List <Entity > fetch (Iterable <Key > keys , ReadOption ... options );
432508
509+ /**
510+ * Returns a list with a value for each given key with specified {@link
511+ * DatastoreExecutionOptions}.
512+ */
513+ @ BetaApi
514+ List <Entity > fetch (Iterable <Key > keys , DatastoreExecutionOptions executionOptions );
515+
433516 /**
434517 * Submits a {@link Query} and returns its result. {@link ReadOption}s can be specified if
435518 * desired.
@@ -492,6 +575,13 @@ interface TransactionCallable<T> {
492575 @ BetaApi
493576 <T > QueryResults <T > run (Query <T > query , ExplainOptions explainOptions , ReadOption ... options );
494577
578+ /**
579+ * Submits a {@link Query} with specified {@link DatastoreExecutionOptions} and returns its
580+ * result.
581+ */
582+ @ BetaApi
583+ <T > QueryResults <T > run (Query <T > query , DatastoreExecutionOptions executionOptions );
584+
495585 /**
496586 * Submits a {@link AggregationQuery} and returns {@link AggregationResults}. {@link ReadOption}s
497587 * can be specified if desired.
@@ -564,6 +654,14 @@ interface TransactionCallable<T> {
564654 AggregationResults runAggregation (
565655 AggregationQuery query , ExplainOptions explainOptions , ReadOption ... options );
566656
657+ /**
658+ * Submits an {@link AggregationQuery} with specified {@link DatastoreExecutionOptions} and
659+ * returns {@link AggregationResults}.
660+ */
661+ @ BetaApi
662+ AggregationResults runAggregation (
663+ AggregationQuery query , DatastoreExecutionOptions executionOptions );
664+
567665 /**
568666 * Closes the gRPC channels associated with this instance and frees up their resources. This
569667 * method blocks until all channels are closed. Once this method is called, this Datastore client
0 commit comments