Interface Session.TransactionalAction
- All Superinterfaces:
Session.Action
- All Known Subinterfaces:
AbstractKVCommand.KVAction
,Session.RetryableTransactionalAction
,Session.TransactionalActionWithOptions
- All Known Implementing Classes:
AbstractTransactionRaftCommand.RaftTransactionAction
- Enclosing class:
- Session
Session.Action
that indicates the action requires an open transaction.
A new transaction will be created if necessary before this action is executed. If a transaction already exists, it will be (re)used.
-
Method Summary
Modifier and TypeMethodDescriptiondefault TransactionConfig
getTransactionConfig
(Session session) Get the configuration for the new Core API transaction.default SessionMode
getTransactionMode
(Session session) Get theSessionMode
corresponding to the transaction that should be opened.Methods inherited from interface io.permazen.cli.Session.Action
run
-
Method Details
-
getTransactionMode
Get theSessionMode
corresponding to the transaction that should be opened.This must be at or below the mode of the given session.
The implementation in
Session.TransactionalAction
returnssession.
Session.getMode()
()
.- Parameters:
session
- current session- Returns:
- transaction mode
- Throws:
IllegalArgumentException
- ifsession
is null
-
getTransactionConfig
Get the configuration for the new Core API transaction.This method is only invoked when the
getTransactionMode(io.permazen.cli.Session)
returnsSessionMode.CORE_API
. Note if thisSession.Action
also implementsSession.TransactionalActionWithOptions
, then a non-null return value fromSession.TransactionalActionWithOptions.getTransactionOptions()
replaces the options configured in theTransactionConfig
returned here, if any.The implementation in
Session.TransactionalAction
returnssession.
Session.newTransactionConfig()
()
.- Parameters:
session
- current session- Returns:
- Core API transaction config
- Throws:
IllegalArgumentException
- ifsession
is null
-