Class Transaction
java.lang.Object
com.loomcache.server.transaction.Transaction
Represents an atomic compare-and-swap transaction (etcd-style mini-transaction).
Structure: A transaction consists of:
- IF: A list of conditions that must all be true (logical AND)
- THEN: Operations to execute if all conditions are met
- ELSE: Operations to execute if any condition fails
Atomicity Guarantee: The transaction is executed atomically: either all THEN operations execute, or all ELSE operations execute, but never both and never partially. This ensures consistency across distributed operations.
Use Case: Suitable for distributed consensus, leader election, version checking, and other scenarios requiring atomic conditional updates across a cluster.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFluent builder for constructing transactions.static final recordCondition to evaluate in the IF branch of a transaction.static enumTypes of conditions that can be evaluated in the IF branch.static final recordOperation to execute in the THEN or ELSE branch of a transaction.static enumTypes of operations that can be executed in THEN/ELSE branches. -
Method Summary
Modifier and TypeMethodDescriptionstatic Transaction.Builderbuilder()Creates a new builder for fluent transaction construction.
-
Method Details
-
builder
Creates a new builder for fluent transaction construction.- Returns:
- a new Builder instance
-