Editor consumer of the common transaction participant/coordinator protocol. 更多...
#include <EditorTransactionConsumer.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| EditorTransactionConsumer (IEditAuthority *authority=nullptr) | |
| Creates a consumer with an optional non-owning edit authority. | |
| ~EditorTransactionConsumer () | |
| Editor transaction consumer. | |
| EditorTransactionConsumer (const EditorTransactionConsumer &)=delete | |
| EditorTransactionConsumer & | operator= (const EditorTransactionConsumer &)=delete |
| eve::Result< void > | setAuthority (IEditAuthority *authority) |
| Changes the borrowed authority when no transaction is active. | |
| eve::Result< TransactionId > | begin (TransactionSpec specification) |
| Begins a transaction with an explicit stable editor identifier. | |
| eve::Result< TransactionId > | beginLegacy (std::string label) |
| Begins a compatibility command transaction with an allocated identifier. | |
| eve::Result< void > | append (std::unique_ptr< IEditCommand > command) |
| Appends a command without publishing its target mutation. | |
| eve::Result< void > | appendPreview (std::unique_ptr< IEditCommand > command) |
| Compatibility-only append that applies a command as an editor preview. | |
| eve::Result< void > | append (DomainOperation operation) |
| Appends a serializable domain operation for authority preflight. | |
| eve::Result< EditorDryRunReport > | dryRun () const |
| Runs structural and authority preflight without publishing state. | |
| eve::Result< EditorTransactionRecord > | commit () |
| Commits the active editor participant set through Coordinator. | |
| eve::Result< EditorTransactionRecord > | commit (std::span< transaction::ITransactionParticipant * > additional) |
| Commits with additional borrowed participants for one composition boundary. | |
| eve::Result< EditorTransactionRecord > | retry (std::span< transaction::ITransactionParticipant * > additional={}) |
| Retries a failed commit while retaining its pending work. | |
| eve::Result< void > | discard () |
| Explicitly discards the pending transaction and any preview. | |
| eve::Result< void > | rollback () |
| Discards the active transaction and any unpublished preview. | |
| eve::Result< EditorTransactionRecord > | undo () |
| Compensates the latest editor-owned commit and moves it to redo history. | |
| eve::Result< EditorTransactionRecord > | redo () |
| Re-executes the latest compensated editor-owned transaction. | |
| bool | active () const noexcept |
| Returns whether an editor transaction is active. | |
| bool | canUndo () const noexcept |
| Returns whether editor-owned history can be compensated. | |
| bool | canRedo () const noexcept |
| Returns whether compensated editor history can be replayed. | |
| std::size_t | undoCount () const noexcept |
| Returns the number of undo entries. | |
| std::size_t | redoCount () const noexcept |
| Returns the number of redo entries. | |
| EditorCommitState | state () const noexcept |
| Returns the explicit state of the active/latest commit lifecycle. | |
| const std::vector< eve::Diagnostic > & | diagnostics () const noexcept |
| Returns diagnostics retained from the latest failed commit attempt. | |
| void | clear () |
| Clears active work and editor-owned undo/redo history. | |
详细描述
Editor consumer of the common transaction participant/coordinator protocol.
This class owns the editor transaction history. It adapts legacy reversible IEditCommand objects to the generic prepare/commit/rollback/compensate lifecycle, and adapts IEditAuthority for serializable DomainOperation work. The consumer is synchronous and owner-thread-only. Authorities, command targets, and extra participants are borrowed and must outlive the call that uses them. No callback is invoked while an internal lock is held.
在文件 EditorTransactionConsumer.h 第 69 行定义.
构造及析构函数说明
◆ EditorTransactionConsumer() [1/2]
|
explicit |
Creates a consumer with an optional non-owning edit authority.
在文件 EditorTransactionConsumer.cpp 第 306 行定义.
◆ ~EditorTransactionConsumer()
|
default |
Editor transaction consumer.
◆ EditorTransactionConsumer() [2/2]
|
delete |
成员函数说明
◆ active()
|
noexcept |
Returns whether an editor transaction is active.
在文件 EditorTransactionConsumer.cpp 第 893 行定义.
◆ append() [1/2]
| eve::Result< void > eve::editor::EditorTransactionConsumer::append | ( | DomainOperation | operation | ) |
Appends a serializable domain operation for authority preflight.
在文件 EditorTransactionConsumer.cpp 第 533 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, operation, eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ append() [2/2]
| eve::Result< void > eve::editor::EditorTransactionConsumer::append | ( | std::unique_ptr< IEditCommand > | command | ) |
Appends a command without publishing its target mutation.
在文件 EditorTransactionConsumer.cpp 第 350 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ appendPreview()
| eve::Result< void > eve::editor::EditorTransactionConsumer::appendPreview | ( | std::unique_ptr< IEditCommand > | command | ) |
Compatibility-only append that applies a command as an editor preview.
- 备注
- The preview is still committed, rolled back, and compensated by the generic participant; new code should use append().
在文件 EditorTransactionConsumer.cpp 第 383 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::InvalidArgument, eve::PreconditionViolation , 以及 eve::Result< T >::success().
◆ begin()
| eve::Result< TransactionId > eve::editor::EditorTransactionConsumer::begin | ( | TransactionSpec | specification | ) |
Begins a transaction with an explicit stable editor identifier.
在文件 EditorTransactionConsumer.cpp 第 320 行定义.
引用了 eve::UuidIdAdapter< Tag >::empty(), eve::Diagnostic::error(), eve::Result< T >::failure(), eve::editing::TransactionSpec::id, eve::InvalidArgument, eve::editor::Pending, pending, eve::PreconditionViolation, eve::editor::EditorTransactionConsumer::Impl::Pending::specification , 以及 eve::Result< T >::success().
被这些函数引用 eve::editor::LocalTransactionBackend::begin() , 以及 eve::editor::EditorTransactions::beginTransaction().
◆ beginLegacy()
| eve::Result< TransactionId > eve::editor::EditorTransactionConsumer::beginLegacy | ( | std::string | label | ) |
Begins a compatibility command transaction with an allocated identifier.
在文件 EditorTransactionConsumer.cpp 第 339 行定义.
引用了 begin, eve::Diagnostic::error(), eve::Failed, eve::Result< T >::failure(), eve::editing::TransactionSpec::id, label , 以及 eve::editing::TransactionSpec::label.
被这些函数引用 eve::editor::EditorTransactions::beginTransaction().
◆ canRedo()
|
noexcept |
Returns whether compensated editor history can be replayed.
在文件 EditorTransactionConsumer.cpp 第 895 行定义.
◆ canUndo()
|
noexcept |
Returns whether editor-owned history can be compensated.
在文件 EditorTransactionConsumer.cpp 第 894 行定义.
◆ clear()
| void eve::editor::EditorTransactionConsumer::clear | ( | ) |
Clears active work and editor-owned undo/redo history.
在文件 EditorTransactionConsumer.cpp 第 903 行定义.
引用了 discard() , 以及 eve::editor::Discarded.
◆ commit() [1/2]
| eve::Result< EditorTransactionRecord > eve::editor::EditorTransactionConsumer::commit | ( | ) |
Commits the active editor participant set through Coordinator.
在文件 EditorTransactionConsumer.cpp 第 583 行定义.
被这些函数引用 eve::editor::LocalTransactionBackend::commit() , 以及 eve::editor::EditorTransactions::commitTransaction().
◆ commit() [2/2]
| eve::Result< EditorTransactionRecord > eve::editor::EditorTransactionConsumer::commit | ( | std::span< transaction::ITransactionParticipant * > | additional | ) |
Commits with additional borrowed participants for one composition boundary.
- 参数
-
additional Participants owned by the caller and used only for this call.
- 备注
- Additional participants are coordinated atomically for this call; editor history only owns the editor participants and therefore a caller must provide their own replay policy for external effects.
在文件 EditorTransactionConsumer.cpp 第 587 行定义.
◆ diagnostics()
|
noexcept |
Returns diagnostics retained from the latest failed commit attempt.
在文件 EditorTransactionConsumer.cpp 第 899 行定义.
◆ discard()
| eve::Result< void > eve::editor::EditorTransactionConsumer::discard | ( | ) |
Explicitly discards the pending transaction and any preview.
- 返回
- Success when all preview state was reverted, otherwise a failure retaining the pending transaction for diagnosis.
在文件 EditorTransactionConsumer.cpp 第 742 行定义.
引用了 eve::Applied, eve::editor::Discarded, eve::Diagnostic::error(), eve::Failed, eve::editor::FailedRetryable, eve::Result< T >::failure(), pending, eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 clear(), eve::editor::LocalTransactionBackend::discard() , 以及 rollback().
◆ dryRun()
| eve::Result< EditorDryRunReport > eve::editor::EditorTransactionConsumer::dryRun | ( | ) | const |
Runs structural and authority preflight without publishing state.
在文件 EditorTransactionConsumer.cpp 第 557 行定义.
引用了 eve::editor::EditorDryRunReport::authorityPlan, eve::editor::EditorDryRunReport::commandCount, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::editor::EditorDryRunReport::operationCount, pending, eve::PreconditionViolation, eve::editor::EditorDryRunReport::specification, eve::Result< T >::success() , 以及 eve::Unsupported.
◆ operator=()
|
delete |
◆ redo()
| eve::Result< EditorTransactionRecord > eve::editor::EditorTransactionConsumer::redo | ( | ) |
Re-executes the latest compensated editor-owned transaction.
在文件 EditorTransactionConsumer.cpp 第 834 行定义.
引用了 eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::authorityReceipt, eve::editor::EditorTransactionRecord::authorityReceipt, eve::editor::EditorTransactionRecord::commandCount, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::commands, eve::editor::Committed, context, eve::editor::EditorTransactionRecord::coordinator, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::editing::TransactionSpec::id, eve::NotFound, eve::editor::EditorTransactionRecord::operationCount, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::operations, eve::PreconditionViolation, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::specification, eve::editor::EditorTransactionRecord::specification, eve::Result< T >::success(), eve::Unsupported , 以及 eve::UuidIdAdapter< Tag >::value().
被这些函数引用 eve::editor::LocalTransactionBackend::redo() , 以及 eve::editor::EditorTransactions::redoTransaction().
◆ redoCount()
|
noexcept |
Returns the number of redo entries.
在文件 EditorTransactionConsumer.cpp 第 897 行定义.
◆ retry()
| eve::Result< EditorTransactionRecord > eve::editor::EditorTransactionConsumer::retry | ( | std::span< transaction::ITransactionParticipant * > | additional = {} | ) |
Retries a failed commit while retaining its pending work.
- 参数
-
additional The same borrowed participant set used by the failed attempt; participants are deliberately not retained by the consumer.
- 返回
- A committed record, or a failure leaving the pending work and diagnostic available for another retry or discard.
- 备注
- A retry uses a fresh attempt transaction id. The caller must provide the same participant instances in the same order and ensure their compensation/rollback contract made them reusable.
在文件 EditorTransactionConsumer.cpp 第 592 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::editor::FailedRetryable, eve::Result< T >::failure() , 以及 eve::PreconditionViolation.
◆ rollback()
| eve::Result< void > eve::editor::EditorTransactionConsumer::rollback | ( | ) |
Discards the active transaction and any unpublished preview.
在文件 EditorTransactionConsumer.cpp 第 779 行定义.
引用了 discard().
被这些函数引用 eve::editor::EditorTransactions::rollbackTransaction().
◆ setAuthority()
| eve::Result< void > eve::editor::EditorTransactionConsumer::setAuthority | ( | IEditAuthority * | authority | ) |
Changes the borrowed authority when no transaction is active.
在文件 EditorTransactionConsumer.cpp 第 311 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::PreconditionViolation , 以及 eve::Result< T >::success().
被这些函数引用 eve::editor::LocalTransactionBackend::setAuthority().
◆ state()
|
noexcept |
Returns the explicit state of the active/latest commit lifecycle.
在文件 EditorTransactionConsumer.cpp 第 898 行定义.
◆ undo()
| eve::Result< EditorTransactionRecord > eve::editor::EditorTransactionConsumer::undo | ( | ) |
Compensates the latest editor-owned commit and moves it to redo history.
在文件 EditorTransactionConsumer.cpp 第 781 行定义.
引用了 eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::authorityReceipt, eve::editor::EditorTransactionRecord::authorityReceipt, eve::editing::TransactionSpec::baseRevision, eve::editor::EditorTransactionRecord::commandCount, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::commands, context, eve::editor::EditorTransactionRecord::coordinator, eve::editor::Discarded, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::editing::TransactionSpec::id, eve::NotFound, eve::editor::EditorTransactionRecord::operationCount, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::operations, eve::PreconditionViolation, eve::editor::EditorTransactionConsumer::Impl::HistoryEntry::specification, eve::editor::EditorTransactionRecord::specification, eve::Result< T >::success(), eve::Unsupported , 以及 eve::UuidIdAdapter< Tag >::value().
被这些函数引用 eve::editor::LocalTransactionBackend::undo() , 以及 eve::editor::EditorTransactions::undoTransaction().
◆ undoCount()
|
noexcept |
Returns the number of undo entries.
在文件 EditorTransactionConsumer.cpp 第 896 行定义.
该类的文档由以下文件生成:
- src/modules/editor/EditorTransactionConsumer.h
- src/modules/editor/EditorTransactionConsumer.cpp