Autosave coordinator that never overwrites the formal document URI. 更多...
#include <EditorDiskDocumentStore.h>
Public 成员函数 | |
| AutosaveService (IAtomicDocumentStore *store, std::string projectId) | |
| Create an autosave namespace. | |
| Result< StoredDocument > | writeDraft (const DocumentSnapshot &snapshot, const EditorValue &content) |
| Write one revisioned draft under autosave://project/document.draft. | |
| Result< AutosaveDraft > | readDraft (const DocumentId &document) const |
| Read a draft and validate its schema. | |
| bool | shouldOfferRecovery (const AutosaveDraft &draft, const DocumentSnapshot &formal) const |
| True when a newer draft differs from the current formal disk base. | |
| std::string | draftUri (const DocumentId &document) const |
| Return the stable draft URI for one document. | |
详细描述
Autosave coordinator that never overwrites the formal document URI.
在文件 EditorDiskDocumentStore.h 第 58 行定义.
构造及析构函数说明
◆ AutosaveService()
|
inline |
Create an autosave namespace.
- 参数
-
store Non-owning atomic store that outlives this service. projectId Stable project identity used in draft URIs.
Store.
在文件 EditorDiskDocumentStore.h 第 65 行定义.
成员函数说明
◆ draftUri()
| std::string eve::editor::AutosaveService::draftUri | ( | const DocumentId & | document | ) | const |
Return the stable draft URI for one document.
在文件 EditorDiskDocumentStore.cpp 第 166 行定义.
引用了 eve::UuidIdAdapter< Tag >::value().
被这些函数引用 readDraft() , 以及 writeDraft().
◆ readDraft()
| Result< AutosaveDraft > eve::editor::AutosaveService::readDraft | ( | const DocumentId & | document | ) | const |
Read a draft and validate its schema.
在文件 EditorDiskDocumentStore.cpp 第 197 行定义.
引用了 eve::editor::AutosaveDraft::baseDiskHash, eve::editor::AutosaveDraft::content, eve::editor::AutosaveDraft::document, draftUri(), eve::editor::AutosaveDraft::editRevision, eve::UuidIdAdapter< Tag >::empty(), eve::Result< T >::failure(), member, eve::editor::IAtomicDocumentStore::read(), root, eve::editor::AutosaveDraft::schemaVersion , 以及 stored.
◆ shouldOfferRecovery()
| bool eve::editor::AutosaveService::shouldOfferRecovery | ( | const AutosaveDraft & | draft, |
| const DocumentSnapshot & | formal | ||
| ) | const |
True when a newer draft differs from the current formal disk base.
在文件 EditorDiskDocumentStore.cpp 第 216 行定义.
引用了 eve::editor::AutosaveDraft::baseDiskHash, eve::editor::DocumentSnapshot::diskContentHash, eve::editor::AutosaveDraft::document, eve::editor::AutosaveDraft::editRevision, eve::editor::DocumentSnapshot::id, eve::editor::DocumentSnapshot::revision , 以及 eve::editor::DocumentRevision::saved.
◆ writeDraft()
| Result< StoredDocument > eve::editor::AutosaveService::writeDraft | ( | const DocumentSnapshot & | snapshot, |
| const EditorValue & | content | ||
| ) |
Write one revisioned draft under autosave://project/document.draft.
在文件 EditorDiskDocumentStore.cpp 第 174 行定义.
引用了 eve::Result< T >::code(), eve::editor::IAtomicDocumentStore::compareAndSwap(), eve::editor::DocumentSnapshot::diskContentHash, draftUri(), eve::editor::DocumentRevision::edit, eve::UuidIdAdapter< Tag >::empty(), hash, eve::editor::DocumentSnapshot::id, eve::Result< T >::ok(), eve::editor::IAtomicDocumentStore::read(), eve::editor::DocumentSnapshot::revision, revision, uri, eve::Result< T >::value() , 以及 eve::UuidIdAdapter< Tag >::value().
该类的文档由以下文件生成:
- src/modules/editor/EditorDiskDocumentStore.h
- src/modules/editor/EditorDiskDocumentStore.cpp