Package com.google.cloud.datastore
Interface DatastoreWriter
- All Known Subinterfaces:
Batch,Datastore,DatastoreBatchWriter,DatastoreReaderWriter,Transaction
- All Known Implementing Classes:
BaseDatastoreBatchWriter
@InternalExtensionOnly
public interface DatastoreWriter
An interface to represent Google Cloud Datastore write operations.
-
Method Summary
Modifier and TypeMethodDescriptionadd(FullEntity<?> entity) Datastore add operation: inserts the provided entity.add(FullEntity<?>... entities) Datastore add operation: inserts the provided entities.voidA datastore delete operation.put(FullEntity<?> entity) A Datastore put (a.k.a upsert) operation: inserts an entity if it does not exist, updates it otherwise.put(FullEntity<?>... entities) A Datastore put (a.k.a upsert) operation: creates an entity if it does not exist, updates it otherwise.voidA Datastore update operation.
-
Method Details
-
add
Datastore add operation: inserts the provided entity. This method will automatically allocate an id if necessary.- Parameters:
entity- the entity to add- Returns:
- an
Entitywith the same properties and a key that is either newly allocated or the same one if key is already complete - Throws:
DatastoreException- upon failureIllegalArgumentException- if the given entity is missing a key
-
add
Datastore add operation: inserts the provided entities. This method will automatically allocate id for any entity with an incomplete key.- Returns:
- a list of
Entityordered by input with the same properties and a key that is either newly allocated or the same one if was already complete - Throws:
DatastoreException- upon failureIllegalArgumentException- if any of the given entities is missing a key- See Also:
-
update
A Datastore update operation. The operation will fail if an entity with the same key does not already exist.- Throws:
DatastoreException- upon failure
-
put
A Datastore put (a.k.a upsert) operation: inserts an entity if it does not exist, updates it otherwise. This method will automatically allocate an id if necessary.- Parameters:
entity- the entity to put- Returns:
- an
Entitywith the same properties and a key that is either newly allocated or the same one if key is already complete - Throws:
DatastoreException- upon failureIllegalArgumentException- if the given entity is missing a key
-
put
A Datastore put (a.k.a upsert) operation: creates an entity if it does not exist, updates it otherwise. This method will automatically allocate id for any entity with an incomplete key.- Returns:
- a list of updated or inserted
Entity, ordered by input. Returned keys are either newly allocated or the same one if was already complete. - Throws:
DatastoreException- upon failureIllegalArgumentException- if any of the given entities is missing a key
-
delete
A datastore delete operation. It is OK to request the deletion of a non-existing key.
-