Class BaseDatastoreBatchWriter (2.17.6)

public abstract class BaseDatastoreBatchWriter implements DatastoreBatchWriter

Base class for DatastoreBatchWriter.

Inheritance

java.lang.Object > BaseDatastoreBatchWriter

Methods

add(FullEntity<?> entity)

public final Entity add(FullEntity<?> entity)

Datastore add operation: inserts the provided entity. This method will automatically allocate an id if necessary. If entity has a complete key and was already marked for deletion in this writer, the operation will be changed to #put.

Parameter
NameDescription
entityFullEntity<?>
Returns
TypeDescription
Entity

add(FullEntity<?>[] entities)

public final 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. For entities with complete keys that were marked for deletion in this writer the operation will be changed to #put.

Parameter
NameDescription
entitiesFullEntity<?>[]
Returns
TypeDescription
List<Entity>

addWithDeferredIdAllocation(FullEntity<?>[] entities)

public final void addWithDeferredIdAllocation(FullEntity<?>[] entities)

Datastore add operation. This method will also allocate id for any entity with an incomplete key. As opposed to #add(FullEntity) and #add(FullEntity...), this method will defer any necessary id allocation to submit time.

Parameter
NameDescription
entitiesFullEntity<?>[]

deactivate()

protected void deactivate()

delete(Key[] keys)

public final void delete(Key[] keys)

A datastore delete operation. It is OK to request the deletion of a non-existing key. This operation will also remove from this batch any prior writes for entities with the same keys.

Parameter
NameDescription
keysKey[]

getDatastore()

protected abstract Datastore getDatastore()
Returns
TypeDescription
Datastore

getName()

protected String getName()
Returns
TypeDescription
String

isActive()

public boolean isActive()

Returns true if still active (write operations were not sent to the Datastore).

Returns
TypeDescription
boolean

newInvalidRequest(String msg, Object[] params)

protected DatastoreException newInvalidRequest(String msg, Object[] params)
Parameters
NameDescription
msgString
paramsObject[]
Returns
TypeDescription
DatastoreException

put(FullEntity<?> entity)

public final 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. This operation will also remove from this writer any prior writes for the same entity.

Parameter
NameDescription
entityFullEntity<?>
Returns
TypeDescription
Entity

put(FullEntity<?>[] entities)

public final 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. This operation will also remove from this writer any prior writes for the same entities.

Parameter
NameDescription
entitiesFullEntity<?>[]
Returns
TypeDescription
List<Entity>

putWithDeferredIdAllocation(FullEntity<?>[] entities)

public final void putWithDeferredIdAllocation(FullEntity<?>[] entities)

Datastore put operation. This method will also allocate id for any entity with an incomplete key. As opposed to #put(FullEntity) and #put(FullEntity...), this method will defer any necessary id allocation to submit time.

Parameter
NameDescription
entitiesFullEntity<?>[]

toAdd()

protected Map<Key,FullEntity<Key>> toAdd()
Returns
TypeDescription
Map<Key,FullEntity<Key>>

toAddAutoId()

protected List<FullEntity<IncompleteKey>> toAddAutoId()
Returns
TypeDescription
List<FullEntity<IncompleteKey>>

toDelete()

protected Set<Key> toDelete()
Returns
TypeDescription
Set<Key>

toMutationPbList()

protected List<Mutation> toMutationPbList()
Returns
TypeDescription
List<Mutation>

toPut()

protected Map<Key,FullEntity<Key>> toPut()
Returns
TypeDescription
Map<Key,FullEntity<Key>>

toUpdate()

protected Map<Key,FullEntity<Key>> toUpdate()
Returns
TypeDescription
Map<Key,FullEntity<Key>>

update(Entity[] entities)

public final void update(Entity[] entities)

A Datastore update operation. The operation will fail if an entity with the same key does not already exist. This operation will be converted to #put operation for entities that were already added or put in this writer.

Parameter
NameDescription
entitiesEntity[]

validateActive()

protected void validateActive()