载入中...
搜索中...
未找到
eve::editor::EditorTransactionConsumer类 参考

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]

eve::editor::EditorTransactionConsumer::EditorTransactionConsumer ( IEditAuthority *  authority = nullptr)
explicit

Creates a consumer with an optional non-owning edit authority.

在文件 EditorTransactionConsumer.cpp 第 306 行定义.

◆ ~EditorTransactionConsumer()

eve::editor::EditorTransactionConsumer::~EditorTransactionConsumer ( )
default

Editor transaction consumer.

◆ EditorTransactionConsumer() [2/2]

eve::editor::EditorTransactionConsumer::EditorTransactionConsumer ( const EditorTransactionConsumer &  )
delete

成员函数说明

◆ active()

bool eve::editor::EditorTransactionConsumer::active ( ) const
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)

◆ 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().

被这些函数引用 eve::editor::EditorTransactions::append().

◆ begin()

◆ 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()

bool eve::editor::EditorTransactionConsumer::canRedo ( ) const
noexcept

Returns whether compensated editor history can be replayed.

在文件 EditorTransactionConsumer.cpp 第 895 行定义.

◆ canUndo()

bool eve::editor::EditorTransactionConsumer::canUndo ( ) const
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.

被这些函数引用 eve::editor::EditorTransactions::clear().

◆ 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.

参数
additionalParticipants 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()

const std::vector< eve::Diagnostic > & eve::editor::EditorTransactionConsumer::diagnostics ( ) const
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()

◆ operator=()

EditorTransactionConsumer & eve::editor::EditorTransactionConsumer::operator= ( const EditorTransactionConsumer &  )
delete

◆ redo()

◆ redoCount()

std::size_t eve::editor::EditorTransactionConsumer::redoCount ( ) const
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.

参数
additionalThe 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.

被这些函数引用 eve::editor::LocalTransactionBackend::retry().

◆ 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()

EditorCommitState eve::editor::EditorTransactionConsumer::state ( ) const
noexcept

Returns the explicit state of the active/latest commit lifecycle.

在文件 EditorTransactionConsumer.cpp 第 898 行定义.

◆ undo()

◆ undoCount()

std::size_t eve::editor::EditorTransactionConsumer::undoCount ( ) const
noexcept

Returns the number of undo entries.

在文件 EditorTransactionConsumer.cpp 第 896 行定义.


该类的文档由以下文件生成: