Synchronous participant contract for one coordinator transaction. 更多...
#include <Transaction.h>
Public 成员函数 | |
| virtual | ~ITransactionParticipant ()=default |
| Releases ITransactionParticipant resources. | |
| virtual std::string_view | name () const noexcept |
| Stable diagnostic name for this participant. | |
| virtual Result< void > | prepare (const TransactionContext &context)=0 |
| Validate and stage local changes for the transaction. | |
| virtual Result< void > | commit (const TransactionContext &context)=0 |
| Publish this participant's staged changes. | |
| virtual Result< void > | rollback (const TransactionContext &context)=0 |
| Discard a prepared but not committed stage. | |
| virtual Result< void > | compensate (const TransactionContext &context)=0 |
| Undo an already committed external effect by compensation. | |
详细描述
Synchronous participant contract for one coordinator transaction.
prepare must validate and stage local changes without exposing them to other systems. A successful commit makes that participant's staged state observable. rollback releases a prepared but uncommitted stage. It must not be used to undo an already committed external effect; that operation is compensate. A participant that cannot compensate must return Unsupported explicitly, allowing the coordinator to report a partial commit instead of silently claiming atomicity.
The coordinator does not own or retain participants. They, their backing stores, and any input objects must outlive the synchronous execute call. Implementations must not invoke unknown callbacks or scripts while holding a lock, and must leave their own state unchanged when a lifecycle method returns a failure Result.
在文件 Transaction.h 第 128 行定义.
构造及析构函数说明
◆ ~ITransactionParticipant()
|
virtualdefault |
Releases ITransactionParticipant resources.
成员函数说明
◆ commit()
|
pure virtual |
Publish this participant's staged changes.
- 参数
-
context Shared borrowed transaction context.
- 返回
- Success when the participant is committed, otherwise diagnostics.
在 eve::card::CardPlayParticipant, eve::dialogue::DialogueStateMutationParticipant, eve::statepatch::StoreTransactionParticipant , 以及 eve::transaction::ResourceDebitParticipant 内被实现.
◆ compensate()
|
pure virtual |
Undo an already committed external effect by compensation.
- 参数
-
context Shared borrowed transaction context.
- 返回
- Success when compensation completes,
Unsupportedwhen impossible, or another failure with diagnostics.
在 eve::card::CardPlayParticipant, eve::dialogue::DialogueStateMutationParticipant, eve::statepatch::StoreTransactionParticipant , 以及 eve::transaction::ResourceDebitParticipant 内被实现.
◆ name()
|
inlinevirtualnoexcept |
Stable diagnostic name for this participant.
- 返回
- A non-owning name valid for the duration of a coordinator call.
被 eve::card::CardPlayParticipant, eve::dialogue::DialogueStateMutationParticipant, eve::statepatch::StoreTransactionParticipant , 以及 eve::transaction::ResourceDebitParticipant 重载.
在文件 Transaction.h 第 137 行定义.
◆ prepare()
|
pure virtual |
Validate and stage local changes for the transaction.
- 参数
-
context Shared borrowed transaction context.
- 返回
- Success when this participant is prepared, otherwise diagnostics.
在 eve::card::CardPlayParticipant, eve::dialogue::DialogueStateMutationParticipant, eve::statepatch::StoreTransactionParticipant , 以及 eve::transaction::ResourceDebitParticipant 内被实现.
◆ rollback()
|
pure virtual |
Discard a prepared but not committed stage.
- 参数
-
context Shared borrowed transaction context.
- 返回
- Success when provisional state is discarded, otherwise diagnostics.
在 eve::card::CardPlayParticipant, eve::dialogue::DialogueStateMutationParticipant, eve::statepatch::StoreTransactionParticipant , 以及 eve::transaction::ResourceDebitParticipant 内被实现.
该类的文档由以下文件生成:
- src/modules/transaction/Transaction.h