Immutable-after-validation operation plan for script-coordinated work. 更多...
#include <Transaction.h>
Public 成员函数 | |
| const std::string & | id () const |
| Returns the stable ledger-local transaction identifier. | |
| const eve::TransactionId & | identity () const noexcept |
| Returns the canonical transaction identity. | |
| State | state () const |
| Returns the current lifecycle state. | |
| const std::string & | correlation () const |
| Returns the correlation identifier supplied at creation. | |
| const std::string & | causation () const |
| Returns the causation identifier supplied at creation. | |
| eve::Result< eve::OperationId > | stage (const std::string &kind, const std::string &target, const std::string &payloadJson="null", eve::OperationId operationId={}) |
| Adds an inert operation with a UUID-backed identity. | |
| eve::Result< void > | markValid (const std::string &operationId) |
| Records a successful validation result for an operation. | |
| eve::Result< void > | markValid (eve::OperationId operationId) |
| Records a successful validation result for a canonical operation. | |
| eve::Result< void > | markInvalid (const std::string &operationId, const std::string &error) |
| Records a failed validation result and its diagnostic. | |
| eve::Result< void > | markInvalid (eve::OperationId operationId, const std::string &error) |
| Records a failed validation result for a canonical operation. | |
| eve::Result< void > | validate () |
| Enters validated state only when every operation was checked and valid. | |
| eve::Result< void > | commit () |
| Commits a validated plan without executing its inert operations. | |
| eve::Result< void > | rollback (const std::string &reason={}) |
| Rolls back an open or validated plan with an optional reason. | |
| eve::Result< void > | fail (const std::string &error) |
| Marks a non-terminal plan failed with a diagnostic. | |
| const std::string & | error () const |
| Returns the latest plan-level error or terminal reason. | |
| int | operationCount () const |
| Returns the number of staged operations. | |
| const Operation * | operationAt (int index) const |
| Returns an operation in staging order, or null for an invalid index. | |
| const Operation * | findOperation (const std::string &operationId) const |
| Returns an operation by stable identifier, or null when absent. | |
| const Operation * | findOperation (eve::OperationId operationId) const |
| Returns an operation by canonical identity, or null when absent. | |
| int | eventCount () const |
| Returns the number of deterministic events. | |
| const Event * | eventAt (int index) const |
| Returns an event in sequence order, or null for an invalid index. | |
| std::string | snapshotJson () const |
| Exports this plan as deterministic compact JSON. | |
友元 | |
| class | Ledger |
详细描述
Immutable-after-validation operation plan for script-coordinated work.
The plan records intent and validation results only. It deliberately does not execute operations against other engine modules.
在文件 Transaction.h 第 241 行定义.
成员函数说明
◆ causation()
| const std::string & eve::transaction::Plan::causation | ( | ) | const |
Returns the causation identifier supplied at creation.
在文件 Transaction.cpp 第 341 行定义.
◆ commit()
| eve::Result< void > eve::transaction::Plan::commit | ( | ) |
Commits a validated plan without executing its inert operations.
在文件 Transaction.cpp 第 466 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::success() , 以及 eve::Result< T >::success().
◆ correlation()
| const std::string & eve::transaction::Plan::correlation | ( | ) | const |
Returns the correlation identifier supplied at creation.
在文件 Transaction.cpp 第 340 行定义.
◆ error()
| const std::string & eve::transaction::Plan::error | ( | ) | const |
Returns the latest plan-level error or terminal reason.
在文件 Transaction.cpp 第 491 行定义.
◆ eventAt()
| const Event * eve::transaction::Plan::eventAt | ( | int | index | ) | const |
Returns an event in sequence order, or null for an invalid index.
- 返回
- Borrowed nullable read-only pointer owned by this plan's event log. @ownership The Plan owns retained events; callers must not delete the result. @lifetime Valid until the plan is destroyed or restored; use event sequence for identity. @thread Call on the plan's owning transaction thread. @reentrancy Do not retain across callbacks or plan mutation.
在文件 Transaction.cpp 第 509 行定义.
引用了 index.
◆ eventCount()
| int eve::transaction::Plan::eventCount | ( | ) | const |
Returns the number of deterministic events.
在文件 Transaction.cpp 第 508 行定义.
◆ fail()
| eve::Result< void > eve::transaction::Plan::fail | ( | const std::string & | error | ) |
Marks a non-terminal plan failed with a diagnostic.
在文件 Transaction.cpp 第 482 行定义.
引用了 eve::Applied, eve::Conflict, error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::success() , 以及 eve::Result< T >::success().
◆ findOperation() [1/2]
| const Operation * eve::transaction::Plan::findOperation | ( | const std::string & | operationId | ) | const |
Returns an operation by stable identifier, or null when absent.
- 返回
- Borrowed nullable read-only pointer owned by this plan. @ownership The Plan owns the operation; callers never release the result. @lifetime Valid until the plan is destroyed or restored; use OperationId for cross-call identity. @thread Call on the plan's owning transaction thread. @reentrancy Do not retain across callbacks or plan mutation.
在文件 Transaction.cpp 第 497 行定义.
引用了 operation.
◆ findOperation() [2/2]
| const Operation * eve::transaction::Plan::findOperation | ( | eve::OperationId | operationId | ) | const |
Returns an operation by canonical identity, or null when absent.
- 返回
- Borrowed nullable read-only pointer owned by this plan. @ownership The Plan owns the operation; callers never release the result. @lifetime Valid until the plan is destroyed or restored; use OperationId for cross-call identity. @thread Call on the plan's owning transaction thread. @reentrancy Do not retain across callbacks or plan mutation.
在文件 Transaction.cpp 第 502 行定义.
引用了 operation.
◆ id()
| const std::string & eve::transaction::Plan::id | ( | ) | const |
Returns the stable ledger-local transaction identifier.
在文件 Transaction.cpp 第 337 行定义.
◆ identity()
|
noexcept |
Returns the canonical transaction identity.
在文件 Transaction.cpp 第 338 行定义.
◆ markInvalid() [1/2]
| eve::Result< void > eve::transaction::Plan::markInvalid | ( | const std::string & | operationId, |
| const std::string & | error | ||
| ) |
Records a failed validation result and its diagnostic.
在文件 Transaction.cpp 第 424 行定义.
引用了 eve::Applied, eve::Conflict, error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::transaction::findMutable(), eve::NotFound, operation, eve::Status::success() , 以及 eve::Result< T >::success().
◆ markInvalid() [2/2]
| eve::Result< void > eve::transaction::Plan::markInvalid | ( | eve::OperationId | operationId, |
| const std::string & | error | ||
| ) |
Records a failed validation result for a canonical operation.
在文件 Transaction.cpp 第 435 行定义.
引用了 eve::Applied, eve::Conflict, error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::transaction::findMutable(), eve::NotFound, operation, eve::Status::success() , 以及 eve::Result< T >::success().
◆ markValid() [1/2]
| eve::Result< void > eve::transaction::Plan::markValid | ( | const std::string & | operationId | ) |
Records a successful validation result for an operation.
在文件 Transaction.cpp 第 402 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::transaction::findMutable(), eve::NotFound, operation, eve::Status::success() , 以及 eve::Result< T >::success().
◆ markValid() [2/2]
| eve::Result< void > eve::transaction::Plan::markValid | ( | eve::OperationId | operationId | ) |
Records a successful validation result for a canonical operation.
在文件 Transaction.cpp 第 413 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::transaction::findMutable(), eve::NotFound, operation, eve::Status::success() , 以及 eve::Result< T >::success().
◆ operationAt()
| const Operation * eve::transaction::Plan::operationAt | ( | int | index | ) | const |
Returns an operation in staging order, or null for an invalid index.
- 返回
- Borrowed nullable read-only pointer owned by this plan. @ownership The Plan owns its operations; callers must not delete or retain the pointer as an identity. @lifetime Valid until the plan is destroyed or restored; use OperationId for cross-call identity. @thread Call on the plan's owning transaction thread. @reentrancy Do not retain across callbacks or plan mutation.
在文件 Transaction.cpp 第 493 行定义.
引用了 index.
◆ operationCount()
| int eve::transaction::Plan::operationCount | ( | ) | const |
Returns the number of staged operations.
在文件 Transaction.cpp 第 492 行定义.
◆ rollback()
| eve::Result< void > eve::transaction::Plan::rollback | ( | const std::string & | reason = {} | ) |
Rolls back an open or validated plan with an optional reason.
在文件 Transaction.cpp 第 473 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::success() , 以及 eve::Result< T >::success().
◆ snapshotJson()
| std::string eve::transaction::Plan::snapshotJson | ( | ) | const |
Exports this plan as deterministic compact JSON.
在文件 Transaction.cpp 第 513 行定义.
引用了 eve::transaction::Event::detail, eve::transaction::Event::operationId, quote, eve::transaction::Event::sequence, eve::transaction::Event::transactionId , 以及 eve::transaction::Event::type.
◆ stage()
| eve::Result< eve::OperationId > eve::transaction::Plan::stage | ( | const std::string & | kind, |
| const std::string & | target, | ||
| const std::string & | payloadJson = "null", |
||
| eve::OperationId | operationId = {} |
||
| ) |
Adds an inert operation with a UUID-backed identity.
- 参数
-
kind Stable operation kind. target Domain target projection. payloadJson Valid JSON payload copied into the plan. operationId Explicit non-nil identity, or nil to use this ledger's injected UUID source.
- 返回
- The canonical operation identity, or a structured failure. No incrementing string ID is generated.
在文件 Transaction.cpp 第 355 行定义.
引用了 eve::Applied, code, eve::Conflict, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::detail::Id128< Tag >::format(), eve::detail::Id128< Tag >::fromUuid(), eve::transaction::Operation::identity, eve::InvalidArgument, eve::detail::Id128< Tag >::isNil(), kind, message, operation, eve::json::Document::parse(), eve::ParseError, eve::Status::success(), eve::Result< T >::success(), target , 以及 eve::Unsupported.
◆ state()
| State eve::transaction::Plan::state | ( | ) | const |
Returns the current lifecycle state.
在文件 Transaction.cpp 第 339 行定义.
◆ validate()
| eve::Result< void > eve::transaction::Plan::validate | ( | ) |
Enters validated state only when every operation was checked and valid.
在文件 Transaction.cpp 第 446 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, operation, eve::Status::success() , 以及 eve::Result< T >::success().
友元及相关函数文档
◆ Ledger
|
friend |
在文件 Transaction.h 第 326 行定义.
该类的文档由以下文件生成:
- src/modules/transaction/Transaction.h
- src/modules/transaction/Transaction.cpp