public interface Datastore extends Service<DatastoreOptions>, DatastoreReaderWriter
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Datastore.TransactionCallable<T>
A callback for running with a transactional
DatastoreReaderWriter. |
| Modifier and Type | Method and Description |
|---|---|
List<Key> |
allocateId(IncompleteKey... key)
Returns a list of keys using the allocated ids ordered by the input.
|
Key |
allocateId(IncompleteKey key)
Allocate a unique id for the given key.
|
void |
delete(Key... key)
A datastore delete operation.
|
List<Entity> |
fetch(Iterable<Key> keys,
ReadOption... options)
Returns a list with a value for each given key (ordered by input).
|
Iterator<Entity> |
get(Iterable<Key> keys,
ReadOption... options)
|
Entity |
get(Key key,
ReadOption... options)
|
Batch |
newBatch()
Returns a new Batch for processing multiple write operations in one request.
|
KeyFactory |
newKeyFactory()
Returns a new KeyFactory for this service
|
Transaction |
newTransaction()
Returns a new Datastore transaction.
|
void |
put(Entity... entity)
A Datastore put (a.k.a upsert) operation.
|
<T> QueryResults<T> |
run(Query<T> query,
ReadOption... options)
Submits a
Query and returns its result. |
<T> T |
runInTransaction(Datastore.TransactionCallable<T> callable)
Invokes the callback's
Datastore.TransactionCallable.run(com.google.cloud.datastore.DatastoreReaderWriter) method with a
DatastoreReaderWriter that is associated with a new transaction. |
void |
update(Entity... entity)
A Datastore update operation.
|
fetch, get, get, runadd, addTransaction newTransaction()
DatastoreException - upon failure<T> T runInTransaction(Datastore.TransactionCallable<T> callable)
Datastore.TransactionCallable.run(com.google.cloud.datastore.DatastoreReaderWriter) method with a
DatastoreReaderWriter that is associated with a new transaction.
The transaction will be committed upon successful invocation.
Any thrown exception will cause the transaction to rollback and will be propagated
as a DatastoreException with the original exception as its root cause.callable - the callback to call with a newly created transactional readerWriterDatastoreException - upon failureBatch newBatch()
Key allocateId(IncompleteKey key)
DatastoreException - upon failureList<Key> allocateId(IncompleteKey... key)
DatastoreException - upon failureallocateId(IncompleteKey)void update(Entity... entity)
update in interface DatastoreWriterDatastoreException - upon failurevoid put(Entity... entity)
put in interface DatastoreWriterDatastoreException - upon failurevoid delete(Key... key)
delete in interface DatastoreWriterDatastoreException - upon failureKeyFactory newKeyFactory()
Entity get(Key key, ReadOption... options)
Entity for the given Key or null if it doesn't exist.
ReadOptions can be specified if desired.DatastoreException - upon failureIterator<Entity> get(Iterable<Key> keys, ReadOption... options)
Entity for each given Key that exists in the Datastore. The order of
the result is unspecified. Results are loaded lazily, so it is possible to get a
DatastoreException from the returned Iterator's
hasNext or next methods. ReadOptions can
be specified if desired.DatastoreException - upon failureDatastoreReader.get(Key)List<Entity> fetch(Iterable<Key> keys, ReadOption... options)
null values are
returned for nonexistent keys. When possible prefer using DatastoreReader.get(Key...) to avoid eagerly
loading the results. ReadOptions can be specified if desired.<T> QueryResults<T> run(Query<T> query, ReadOption... options)
Query and returns its result. ReadOptions can be specified if
desired.DatastoreException - upon failureCopyright © 2016 Google. All rights reserved.