Class CrossGroupTransactionContext
java.lang.Object
com.loomcache.server.sharding.CrossGroupTransactionContext
Partitions a transaction's conditions and operations by their target Raft group.
Given a PartitionRouter, each condition and operation key is routed to
its owning group. This allows the CrossGroupTransactionExecutor to
evaluate conditions and execute operations on the correct group's data.
- Since:
- 2.0
-
Constructor Summary
ConstructorsConstructorDescriptionCrossGroupTransactionContext(Transaction transaction, PartitionRouter router) Create a cross-group context by routing all keys through the partition router. -
Method Summary
Modifier and TypeMethodDescriptionconditionsForGroup(int groupId) Get conditions targeted at a specific group.elseOpsForGroup(int groupId) Get ELSE operations targeted at a specific group.intGet the total number of groups involved.booleanWhether this transaction spans multiple groups.Get all group IDs involved in this transaction, sorted ascending.thenOpsForGroup(int groupId) Get THEN operations targeted at a specific group.
-
Constructor Details
-
CrossGroupTransactionContext
Create a cross-group context by routing all keys through the partition router.- Parameters:
transaction- the transaction to partitionrouter- the partition router for key-to-group mapping
-
-
Method Details
-
sortedGroupIds
-
conditionsForGroup
Get conditions targeted at a specific group.- Parameters:
groupId- the group ID- Returns:
- list of conditions for this group (empty if none)
-
thenOpsForGroup
Get THEN operations targeted at a specific group.- Parameters:
groupId- the group ID- Returns:
- list of THEN operations for this group (empty if none)
-
elseOpsForGroup
Get ELSE operations targeted at a specific group.- Parameters:
groupId- the group ID- Returns:
- list of ELSE operations for this group (empty if none)
-
isMultiGroup
public boolean isMultiGroup()Whether this transaction spans multiple groups.- Returns:
- true if more than one group is involved
-
groupCount
public int groupCount()Get the total number of groups involved.- Returns:
- the group count
-