Package io.deephaven.kv
Class Transaction
java.lang.Object
io.deephaven.kv.Transaction
- All Implemented Interfaces:
Composable,Request<TransactionResponse>
A transaction is an if/else construct. On execution, if the
getCondition() evaluates to
true, then the request(s) as described by getOnConditionTrueOperation() are executed;
otherwise, the request(s) as described by getOnConditionFalseOperation() are executed.
Transactions enable application logic to dictate desired atomicity, through the use of compare-and-set like constructions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.kv.Composable
Composable.Empty -
Method Summary
Modifier and TypeMethodDescriptiondescribe()An unfiltered description of the Request.describe(RequestVisitorFilter filter) booleanShould only be called afterRequest.hasResponse()is true.inthashCode()booleanvoidtraverse(@NotNull RequestVisitor visitor) Invokes the appropriately typedRequestVisitormethod that corresponds to the concrete type of thisRequest.static Transactiontxn(@NotNull Condition condition, @NotNull Composable onTrue, @NotNull Composable onFalse) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.deephaven.kv.Composable
isEmpty, traverseAllMethods inherited from interface io.deephaven.kv.Request
getOperations
-
Method Details
-
txn
public static Transaction txn(@NotNull @NotNull Condition condition, @NotNull @NotNull Composable onTrue, @NotNull @NotNull Composable onFalse) -
getCondition
-
getOnConditionTrueOperation
-
getOnConditionFalseOperation
-
traverse
Description copied from interface:RequestInvokes the appropriately typedRequestVisitormethod that corresponds to the concrete type of thisRequest.Thus, all implementations are essentially
visitor.visit((ConcreteType)this).- Specified by:
traversein interfaceRequest<TransactionResponse>- Parameters:
visitor- the visitor
-
describe
Description copied from interface:RequestAn unfiltered description of the Request. Meant to be used for debugging and development purposes.- Specified by:
describein interfaceRequest<TransactionResponse>
-
describe
-
hasResponse
public boolean hasResponse()- Specified by:
hasResponsein interfaceRequest<TransactionResponse>- Returns:
- true iff the response has been set
-
getResponse
Description copied from interface:RequestShould only be called afterRequest.hasResponse()is true.- Specified by:
getResponsein interfaceRequest<TransactionResponse>- Returns:
- the response
-
equals
-
hashCode
public int hashCode()
-