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 TransactionConfiggetTransactionConfig(Session session) Get the configuration for the new Core API transaction.default SessionModegetTransactionMode(Session session) Get theSessionModecorresponding to the transaction that should be opened.Methods inherited from interface io.permazen.cli.Session.Action
run
-
Method Details
-
getTransactionMode
Get theSessionModecorresponding to the transaction that should be opened.This must be at or below the mode of the given session.
The implementation in
Session.TransactionalActionreturnssession.Session.getMode()().- Parameters:
session- current session- Returns:
- transaction mode
- Throws:
IllegalArgumentException- ifsessionis 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.Actionalso implementsSession.TransactionalActionWithOptions, then a non-null return value fromSession.TransactionalActionWithOptions.getTransactionOptions()replaces the options configured in theTransactionConfigreturned here, if any.The implementation in
Session.TransactionalActionreturnssession.Session.newTransactionConfig()().- Parameters:
session- current session- Returns:
- Core API transaction config
- Throws:
IllegalArgumentException- ifsessionis null
-