- All Superinterfaces:
public interface DatastoreService extends BaseDatastoreServiceThe
DatastoreServiceprovides synchronous access to a schema-less data storage system. The fundamental unit of data in this system is the
Entity, which has an immutable identity (represented by a
Key) and zero or more mutable properties.
Entityobjects can be created, updated, deleted, retrieved by identifier, and queried via a combination of properties.
DatastoreServicecan be used transactionally and supports the notion of a "current" transaction. A current transaction is established by calling
beginTransaction(). The transaction returned by this method ceases to be current when an attempt is made to commit or rollback or when another call is made to
beginTransaction(). A transaction can only be current within the Thread that created it.
The various overloads of put, get, and delete all support transactions. Users of this class have the choice of explicitly passing a (potentially
Transactionto these methods or relying on the behavior governed by the
ImplicitTransactionManagementPolicy. If a user explicitly provides a
Transactionit is up to the user to call
Transaction.rollback()at the proper time. If a user relies on implicit transaction management and the installed policy creates a transaction, that transaction will be committed (in the case of a success) or rolled back (in the case of a failure) before the operation returns to the user. The methods that manage transactions according to
The overload of prepare that takes a
Transactionparameter behaves the same as the overloads of put, get, and delete that take a
Transactionparameter. However, the overload of prepare that does not take a
Transactionparameter, unlike put, get, and delete, does not use an existing
Transactionif one is already running and does not consult the
ImplicitTransactionManagementPolicyif one is not already running.
Nested Class Summary
Nested Classes Modifier and Type Interface and Description
DatastoreService.KeyRangeStateIndicates the state of a
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description
allocateIdRange(KeyRange range)This method allocates a user-specified contiguous range of unique IDs.
allocateIds(Key parent, java.lang.String kind, long num)IDs are allocated within a namespace defined by a parent key and a kind.
allocateIds(java.lang.String kind, long num)IDs are allocated within a namespace defined by a parent key and a kind.
beginTransaction(TransactionOptions options)Begins a transaction against the datastore.
delete(java.lang.Iterable<Key> keys)Equivalent to
delete(Key... keys)Deletes the
Entity entitiesspecified by
delete(Transaction txn, java.lang.Iterable<Key> keys)Exhibits the same behavior as
delete(Iterable), but executes within the provided transaction.
delete(Transaction txn, Key... keys)Exhibits the same behavior as
delete(Key...), but executes within the provided transaction.
get(java.lang.Iterable<Key> keys)Retrieves the set of
get(Key key)Retrieves the
Entitywith the specified
get(Transaction txn, java.lang.Iterable<Key> keys)Exhibits the same behavior as
get(Iterable), but executes within the provided transaction.
get(Transaction txn, Key key)Exhibits the same behavior as
get(Key), but executes within the provided transaction.
getDatastoreAttributes()Retrieves the current datastore's attributes.
getIndexes()Returns the application indexes and their states.
put(Entity entity)If the specified
Entitydoes not yet exist in the data store, create it and assign its
put(java.lang.Iterable<Entity> entities)Performs a batch
put(Transaction txn, Entity entity)Exhibits the same behavior as
put(Entity), but executes within the provided transaction.