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

Document coordinator with revision-safe requestSave/executeSave sequencing. 更多...

#include <EditorDocumentService.h>

Public 类型

using ContentValidator = std::function< Result< void >(const EditorValue &)>
 Synchronous content validator borrowed only for one external reconciliation call.
 

Public 成员函数

 DocumentService (IAtomicDocumentStore *store)
 Document service.
 
Result< DocumentSnapshot > open (DocumentKey key, std::string title, std::string resourceUri, EditorValue initialContent={})
 Open an asset-backed document, loading existing persisted content when present.
 
Result< DocumentSnapshot > edit (const DocumentId &document, EditorValue content, std::optional< Revision > expectedRevision=std::nullopt)
 Replace the working content using an optional expected edit revision.
 
Result< SaveTicket > requestSave (const DocumentId &document)
 Capture an exact content/revision pair for a later CAS save.
 
Result< DocumentSnapshot > executeSave (const SaveTicket &ticket)
 Execute a captured save ticket without reading newer working content.
 
Result< EditorValue > content (const DocumentId &document) const
 Return the current working content snapshot.
 
Result< DocumentSnapshot > snapshot (const DocumentId &document) const
 Return one metadata snapshot.
 
std::vector< DocumentSnapshot > documents () const
 Return all open documents in stable id order.
 
Result< DocumentSnapshot > reconcileExternal (const DocumentId &document)
 Reconcile one open document with the latest store value. Clean documents adopt external content; dirty documents enter Conflict without losing their working content.
 
Result< DocumentSnapshot > reconcileExternal (const DocumentId &document, ContentValidator validator)
 Reconcile external content only after a domain validator accepts the complete candidate.
 
Result< void > close (const DocumentId &document)
 Close and discard in-memory state; persisted content is unchanged.
 

详细描述

Document coordinator with revision-safe requestSave/executeSave sequencing.

The store is non-owning and must outlive this service. A successful old save ticket advances saved only to its captured edit revision, preserving dirty state for edits made while the save was pending.

在文件 EditorDocumentService.h 第 118 行定义.

成员类型定义说明

◆ ContentValidator

Synchronous content validator borrowed only for one external reconciliation call.

在文件 EditorDocumentService.h 第 121 行定义.

构造及析构函数说明

◆ DocumentService()

eve::editor::DocumentService::DocumentService ( IAtomicDocumentStore *  store)
inlineexplicit

Document service.

在文件 EditorDocumentService.h 第 124 行定义.

成员函数说明

◆ close()

Result< void > eve::editor::DocumentService::close ( const DocumentId &  document)

Close and discard in-memory state; persisted content is unchanged.

在文件 EditorDocumentService.cpp 第 218 行定义.

被这些函数引用 eve::editor::ActionTimelineDocumentWorkspace::close().

◆ content()

Result< EditorValue > eve::editor::DocumentService::content ( const DocumentId &  document) const

◆ documents()

std::vector< DocumentSnapshot > eve::editor::DocumentService::documents ( ) const

Return all open documents in stable id order.

在文件 EditorDocumentService.cpp 第 132 行定义.

引用了 left , 以及 right.

◆ edit()

Result< DocumentSnapshot > eve::editor::DocumentService::edit ( const DocumentId &  document,
EditorValue  content,
std::optional< Revision >  expectedRevision = std::nullopt 
)

Replace the working content using an optional expected edit revision.

在文件 EditorDocumentService.cpp 第 65 行定义.

引用了 content(), error, found , 以及 eve::editor::Ready.

被这些函数引用 eve::editor::EditorSession::editDocument().

◆ executeSave()

◆ open()

Result< DocumentSnapshot > eve::editor::DocumentService::open ( DocumentKey  key,
std::string  title,
std::string  resourceUri,
EditorValue  initialContent = {} 
)

Open an asset-backed document, loading existing persisted content when present.

在文件 EditorDocumentService.cpp 第 34 行定义.

引用了 error, id, key, eve::editor::IAtomicDocumentStore::read(), eve::editor::Ready, snapshot(), stored , 以及 title.

被这些函数引用 eve::editor::ActionTimelineDocumentWorkspace::open().

◆ reconcileExternal() [1/2]

Result< DocumentSnapshot > eve::editor::DocumentService::reconcileExternal ( const DocumentId &  document)

Reconcile one open document with the latest store value. Clean documents adopt external content; dirty documents enter Conflict without losing their working content.

参数
documentStable identity of the open document to inspect.
返回
Updated snapshot or a structured conflict/failure.

在文件 EditorDocumentService.cpp 第 144 行定义.

引用了 reconcileExternal().

被这些函数引用 eve::editor::EditorSession::pollDocumentChanges(), eve::editor::ActionTimelineDocumentWorkspace::reconcile() , 以及 reconcileExternal().

◆ reconcileExternal() [2/2]

Result< DocumentSnapshot > eve::editor::DocumentService::reconcileExternal ( const DocumentId &  document,
ContentValidator  validator 
)

Reconcile external content only after a domain validator accepts the complete candidate.

参数
documentStable identity of the open document to inspect.
validatorSynchronous callback invoked without a service lock and never retained.
返回
Updated snapshot, or a structured failure preserving the previous working content.

在文件 EditorDocumentService.cpp 第 148 行定义.

引用了 eve::Conflict, eve::editor::Conflict, error, eve::editor::Failed, eve::Result< T >::failure(), found, eve::InvalidArgument, eve::NotFound, eve::editor::IAtomicDocumentStore::read(), eve::editor::Ready, eve::editing::ruleDiagnostic(), status , 以及 stored.

◆ requestSave()

◆ snapshot()


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