载入中...
搜索中...
未找到
EditorDiskDocumentStore.cpp
浏览该文件的文档.
37 return eve::editing::failed<AutosaveDraft>(EditorStatus::Rejected, RuleId(rule), std::move(message));
74 if (path.empty()) return failure(EditorStatus::Rejected, "editor.document.invalid-uri", "Rejected resource URI");
104 if (path.empty()) return failure(EditorStatus::Rejected, "editor.document.invalid-uri", "Rejected resource URI");
134 if (!output) return failure(EditorStatus::Failed, "editor.document.temp-open", "Cannot open temp file");
158 return MoveFileExW(temporary.c_str(), destination.c_str(), MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH) != 0;
174Result<StoredDocument> AutosaveService::writeDraft(const DocumentSnapshot& snapshot, const EditorValue& content) {
176 return eve::editing::failed<StoredDocument>(EditorStatus::Rejected, RuleId("editor.autosave.invalid"),
198 if (!store_ || document.empty()) return draftFailure("editor.autosave.invalid", "Autosave store is required");
204 return draftFailure("editor.autosave.unsupported-schema", "Autosave draft schemaVersion must be 1");
216bool AutosaveService::shouldOfferRecovery(const AutosaveDraft& draft, const DocumentSnapshot& formal) const {
const T & value() const &
Borrow the value from a const lvalue after checking success.
Definition Result.h:308
bool ok() const noexcept
Whether this result represents a non-failure outcome.
Definition Result.h:255
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
const std::string & value() const noexcept
Returns the exact legacy or canonical compatibility spelling.
Definition Identity.h:362
bool empty() const noexcept
True when no compatibility spelling has been assigned.
Definition Identity.h:374
Deterministic owning value tree shared by authoring hosts.
Definition EditingValue.h:19
Result< AutosaveDraft > readDraft(const DocumentId &document) const
Read a draft and validate its schema.
Definition EditorDiskDocumentStore.cpp:197
bool shouldOfferRecovery(const AutosaveDraft &draft, const DocumentSnapshot &formal) const
True when a newer draft differs from the current formal disk base.
Definition EditorDiskDocumentStore.cpp:216
std::string draftUri(const DocumentId &document) const
Return the stable draft URI for one document.
Definition EditorDiskDocumentStore.cpp:166
Result< StoredDocument > writeDraft(const DocumentSnapshot &snapshot, const EditorValue &content)
Write one revisioned draft under autosave://project/document.draft.
Definition EditorDiskDocumentStore.cpp:174
Result< StoredDocument > compareAndSwap(const std::string &resourceUri, Revision expectedRevision, const std::string &expectedContentHash, const EditorValue &content) override
CAS and atomically replace one document envelope on disk.
Definition EditorDiskDocumentStore.cpp:99
DiskAtomicDocumentStore(std::filesystem::path projectRoot)
Create a store rooted at a project directory.
Definition EditorDiskDocumentStore.cpp:42
std::filesystem::path resolve(const std::string &resourceUri) const
Resolve a logical URI to a canonical project path, or an empty path when rejected.
Definition EditorDiskDocumentStore.cpp:48
Result< StoredDocument > read(const std::string &resourceUri) const override
Read and validate the latest atomic document envelope.
Definition EditorDiskDocumentStore.cpp:72
virtual Result< StoredDocument > read(const std::string &resourceUri) const =0
Read the latest value for a resource URI.
virtual Result< StoredDocument > compareAndSwap(const std::string &resourceUri, Revision expectedRevision, const std::string &expectedContentHash, const EditorValue &content)=0
Replace a value only when the expected disk revision still matches.
Definition ActionPreviewController.cpp:6
eve::editing::Value EditorValue
Compatibility alias for the UI-independent authoring value tree.
Definition EditorValue.h:8
const EditorValue * field(const EditorValue &value, const char *name)
Definition RoadNetworkEditTarget.cpp:15
Persisted draft metadata used to decide whether recovery should be offered.
Definition EditorDiskDocumentStore.h:49
std::uint32_t schemaVersion
Definition EditorDiskDocumentStore.h:52
Revision editRevision
Definition EditorDiskDocumentStore.h:53
std::string baseDiskHash
Definition EditorDiskDocumentStore.h:51
Immutable document metadata snapshot.
Definition EditorDocumentService.h:53
std::string diskContentHash
Definition EditorDocumentService.h:60
DocumentRevision revision
Definition EditorDocumentService.h:59
Value snapshot returned by an atomic document store.
Definition EditorDocumentService.h:78