public abstract class BaseDatastoreBatchWriter extends Object implements DatastoreBatchWriter
Modifier and Type | Method and Description |
---|---|
List<Entity> |
add(FullEntity<?>... entities)
Datastore add operation: inserts the provided entities.
|
Entity |
add(FullEntity<?> entity)
Datastore add operation: inserts the provided entity.
|
void |
addWithDeferredIdAllocation(FullEntity<?>... entities)
Datastore add operation.
|
protected void |
deactivate() |
void |
delete(Key... keys)
A datastore delete operation.
|
protected abstract Datastore |
getDatastore() |
protected String |
getName() |
boolean |
isActive()
Returns
true if still active (write operations were not sent to the Datastore). |
protected DatastoreException |
newInvalidRequest(String msg,
Object... params) |
List<Entity> |
put(FullEntity<?>... entities)
A Datastore put (a.k.a upsert) operation: creates an entity if it does not exist, updates it
otherwise.
|
Entity |
put(FullEntity<?> entity)
A Datastore put (a.k.a upsert) operation: inserts an entity if it does not exist, updates it
otherwise.
|
void |
putWithDeferredIdAllocation(FullEntity<?>... entities)
Datastore put operation.
|
protected Map<Key,FullEntity<Key>> |
toAdd() |
protected List<FullEntity<IncompleteKey>> |
toAddAutoId() |
protected Set<Key> |
toDelete() |
protected List<Mutation> |
toMutationPbList() |
protected Map<Key,FullEntity<Key>> |
toPut() |
protected Map<Key,FullEntity<Key>> |
toUpdate() |
void |
update(Entity... entities)
A Datastore update operation.
|
protected void |
validateActive() |
public final void addWithDeferredIdAllocation(FullEntity<?>... entities)
DatastoreBatchWriter
DatastoreBatchWriter.add(FullEntity)
and DatastoreBatchWriter.add(FullEntity...)
, this method will
defer any necessary id allocation to submit time.addWithDeferredIdAllocation
in interface DatastoreBatchWriter
public final Entity add(FullEntity<?> entity)
DatastoreBatchWriter
entity
has a complete key and was already marked for deletion in this
writer, the operation will be changed to DatastoreBatchWriter.put(com.google.cloud.datastore.FullEntity<?>)
.add
in interface DatastoreBatchWriter
add
in interface DatastoreWriter
entity
- the entity to addEntity
with the same properties and a key that is either newly allocated or
the same one if key is already completepublic final List<Entity> add(FullEntity<?>... entities)
DatastoreBatchWriter
DatastoreBatchWriter.put(com.google.cloud.datastore.FullEntity<?>)
.add
in interface DatastoreBatchWriter
add
in interface DatastoreWriter
Entity
ordered by input with the same properties and a key that is
either newly allocated or the same one if was already completeDatastoreWriter.add(FullEntity)
@SafeVarargs public final void update(Entity... entities)
DatastoreBatchWriter
DatastoreBatchWriter.put(com.google.cloud.datastore.FullEntity<?>)
operation for entities that were
already added or put in this writer.update
in interface DatastoreBatchWriter
update
in interface DatastoreWriter
public final Entity put(FullEntity<?> entity)
DatastoreBatchWriter
put
in interface DatastoreBatchWriter
put
in interface DatastoreWriter
entity
- the entity to putEntity
with the same properties and a key that is either newly allocated or
the same one if key is already completepublic final void putWithDeferredIdAllocation(FullEntity<?>... entities)
DatastoreBatchWriter
DatastoreBatchWriter.put(FullEntity)
and DatastoreBatchWriter.put(FullEntity...)
, this method will
defer any necessary id allocation to submit time.putWithDeferredIdAllocation
in interface DatastoreBatchWriter
public final List<Entity> put(FullEntity<?>... entities)
DatastoreBatchWriter
put
in interface DatastoreBatchWriter
put
in interface DatastoreWriter
Entity
, ordered by input. Returned keys are
either newly allocated or the same one if was already complete.public final void delete(Key... keys)
DatastoreBatchWriter
delete
in interface DatastoreBatchWriter
delete
in interface DatastoreWriter
public boolean isActive()
DatastoreBatchWriter
true
if still active (write operations were not sent to the Datastore).isActive
in interface DatastoreBatchWriter
protected String getName()
protected Map<Key,FullEntity<Key>> toAdd()
protected List<FullEntity<IncompleteKey>> toAddAutoId()
protected Map<Key,FullEntity<Key>> toUpdate()
protected Map<Key,FullEntity<Key>> toPut()
protected void deactivate()
protected void validateActive()
protected DatastoreException newInvalidRequest(String msg, Object... params)
protected abstract Datastore getDatastore()
Copyright © 2023 Google LLC. All rights reserved.