1 // Copyright 2010 Google Inc. All Rights Reserved.
2 package com
.google
.appengine
.api
.datastore
;
6 import java
.util
.concurrent
.Future
;
9 * An asynchronous version of {@link DatastoreService}. All methods return
10 * immediately and provide {@link Future Futures} as their return values.
12 * The key difference between implementations of {@link AsyncDatastoreService}
13 * and implementations of {@link DatastoreService} is that async
14 * implementations do not perform implicit transaction management. The reason
15 * is that implicit transaction management requires automatic commits of some
16 * transactions, and without some sort of callback mechanism there is no way
17 * to determine that a put/get/delete that has been implicitly enrolled in a
18 * transaction is complete and therefore ready to be committed. See
19 * {@link ImplicitTransactionManagementPolicy} for more information.
22 public interface AsyncDatastoreService
extends BaseDatastoreService
{
24 * @see DatastoreService#get(Key)
26 Future
<Entity
> get(Key key
);
29 * @see DatastoreService#get(Transaction, Key)
31 Future
<Entity
> get(Transaction txn
, Key key
);
34 * @see DatastoreService#get(Iterable)
36 Future
<Map
<Key
, Entity
>> get(Iterable
<Key
> keys
);
39 * @see DatastoreService#get(Transaction, Iterable)
41 Future
<Map
<Key
, Entity
>> get(Transaction txn
, Iterable
<Key
> keys
);
44 * @see DatastoreService#put(Entity)
46 Future
<Key
> put(Entity entity
);
49 * @see DatastoreService#put(Transaction, Entity)
51 Future
<Key
> put(Transaction txn
, Entity entity
);
54 * @see DatastoreService#put(Iterable)
56 Future
<List
<Key
>> put(Iterable
<Entity
> entities
);
59 * @see DatastoreService#put(Transaction, Iterable)
61 Future
<List
<Key
>> put(Transaction txn
, Iterable
<Entity
> entities
);
64 * @see DatastoreService#delete(Key...)
66 Future
<Void
> delete(Key
... keys
);
69 * @see DatastoreService#delete(Transaction, Iterable)
71 Future
<Void
> delete(Transaction txn
, Key
... keys
);
74 * @see DatastoreService#delete(Iterable)
76 Future
<Void
> delete(Iterable
<Key
> keys
);
79 * @see DatastoreService#delete(Transaction, Iterable)
81 Future
<Void
> delete(Transaction txn
, Iterable
<Key
> keys
);
84 * @see DatastoreService#beginTransaction()
86 Future
<Transaction
> beginTransaction();
89 * @see DatastoreService#beginTransaction(TransactionOptions)
91 Future
<Transaction
> beginTransaction(TransactionOptions options
);
94 * @see DatastoreService#allocateIds(String, long)
96 Future
<KeyRange
> allocateIds(String kind
, long num
);
99 * @see DatastoreService#allocateIds(Key, String, long)
101 Future
<KeyRange
> allocateIds(Key parent
, String kind
, long num
);
104 * @see DatastoreService#getDatastoreAttributes()
106 Future
<DatastoreAttributes
> getDatastoreAttributes();
109 * @see DatastoreService#getIndexes()
111 Future
<Map
<Index
, Index
.IndexState
>> getIndexes();