Package com.google.cloud.datastore
Interface DatastoreWriter
-
- All Known Subinterfaces:
Batch
,Datastore
,DatastoreBatchWriter
,DatastoreReaderWriter
,Transaction
- All Known Implementing Classes:
BaseDatastoreBatchWriter
public interface DatastoreWriter
An interface to represent Google Cloud Datastore write operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Entity
add(FullEntity<?> entity)
Datastore add operation: inserts the provided entity.List<Entity>
add(FullEntity<?>... entities)
Datastore add operation: inserts the provided entities.void
delete(Key... keys)
A datastore delete operation.Entity
put(FullEntity<?> entity)
A Datastore put (a.k.a upsert) operation: inserts an entity if it does not exist, updates it otherwise.List<Entity>
put(FullEntity<?>... entities)
A Datastore put (a.k.a upsert) operation: creates an entity if it does not exist, updates it otherwise.void
update(Entity... entities)
A Datastore update operation.
-
-
-
Method Detail
-
add
Entity add(FullEntity<?> entity)
Datastore add operation: inserts the provided entity. This method will automatically allocate an id if necessary.- Parameters:
entity
- the entity to add- Returns:
- an
Entity
with 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
List<Entity> add(FullEntity<?>... entities)
Datastore add operation: inserts the provided entities. This method will automatically allocate id for any entity with an incomplete key.- Returns:
- a list of
Entity
ordered 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:
add(FullEntity)
-
update
void update(Entity... entities)
A Datastore update operation. The operation will fail if an entity with the same key does not already exist.- Throws:
DatastoreException
- upon failure
-
put
Entity put(FullEntity<?> entity)
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
Entity
with 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
List<Entity> put(FullEntity<?>... entities)
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
void delete(Key... keys)
A datastore delete operation. It is OK to request the deletion of a non-existing key.
-
-