1 package com
.google
.appengine
.api
.datastore
;
3 import com
.google
.apphosting
.datastore
.DatastoreV4
.BeginTransactionResponse
;
4 import com
.google
.apphosting
.datastore
.DatastoreV4
.CommitRequest
;
5 import com
.google
.apphosting
.datastore
.DatastoreV4
.Mutation
;
7 import java
.util
.Collection
;
8 import java
.util
.concurrent
.Future
;
11 * Stores transaction state as java proto objects, with the expectation that the
12 * {@link DatastoreV4Proxy} will need to inspect a deserialized version of the commit.
14 class InternalTransactionCloudDatastore
extends BaseInternalTransactionV4
<Mutation
> {
16 * Objects should be created with {@link #create(DatastoreV4Proxy, Future)} due
17 * to post-construction manipulation.
19 private InternalTransactionCloudDatastore(DatastoreV4Proxy dsApiProxy
,
20 Future
<BeginTransactionResponse
> beginTxnFuture
) {
21 super(dsApiProxy
, beginTxnFuture
);
24 static TransactionImpl
.InternalTransaction
create(DatastoreV4Proxy dsApiProxy
,
25 Future
<BeginTransactionResponse
> future
) {
26 return registerTxn(new InternalTransactionCloudDatastore(dsApiProxy
, future
));
30 Mutation
serializeMutation(Mutation mutation
) {
35 Future
<?
> sendCommit(Collection
<Mutation
> mutations
) {
36 return dsApiProxy
.commit(CommitRequest
.newBuilder()
37 .setTransaction(getHandle())
38 .addAllMutation(mutations
)