CrossPartitionBatch class
A cross-partition transactional batch. This class can handle operations targetting
multiple partition keys, and supports more than 100 operations. Atomic behavior is
not possible with this class, and isAtomic will always be false
. Stopping on
error is also not possible with this implementation and continueOnError will
always be true
.
Constructors
- CrossPartitionBatch(CosmosDbContainer container, {PartitionKey? partitionKey})
Properties
- container → CosmosDbContainer
-
The container this batch instance is attached to.
finalinherited
- continueOnError → bool
-
Cross-partition batches always have continueOnError =
true
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The document's id.
finalinherited
- isAtomic → bool
-
Cross-partition batches cannot be atomic and always have isAtomic =
false
.final - isCrossPartition → bool
-
If
true
, operations registered with this batch may target multiple partition keys. Operations will be grouped by partition keys when execute is called. Implies continueOnError =true
and isAtomic =false
.final - length → int
-
The number of operations in this batch instance.
no setteroverride
-
operations
→ Iterable<
BatchOperation> -
The list of operations registered with this batch instance.
no setteroverride
- partitionKey → PartitionKey?
-
The default partition key for operations in this batch.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
BatchOperation op) → void -
Adds the specified BatchOperation to this batch instance.
override
-
create<
T extends BaseDocument> (T item, {PartitionKey? partitionKey}) → void -
Adds a BatchOperationCreate to this batch instance.
inherited
-
delete(
String id, {PartitionKey? partitionKey}) → void -
Adds a BatchOperationDelete to this batch instance.
inherited
-
execute(
{CosmosDbPermission? permission}) → Future< BatchResponse> -
Executes the BatchOperations registered in this batch instance. Operations are grouped
by partition keys and sent to Cosmos DB in chunks of 100 operations per partition key.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch<
T extends BaseDocument> (String id, {PartitionKey? partitionKey}) → BatchOperationPatch< BaseDocument> -
Adds a BatchOperationPatch to this batch instance.
inherited
-
read<
T extends BaseDocument> (String id, {PartitionKey? partitionKey}) → void -
Adds a BatchOperationRead to this batch instance.
inherited
-
recycle(
) → void -
Recycles this batch instance for reuse. This method clears the list of operations.
override
-
replace<
T extends BaseDocument> (T item, {PartitionKey? partitionKey}) → void -
Adds a BatchOperationReplace to this batch instance.
inherited
-
toJson(
) → List -
Serializes this instance to a JSON object.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
upsert<
T extends BaseDocument> (T item, {PartitionKey? partitionKey}) → void -
Adds a BatchOperationUpsert to this batch instance.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited