feat(database): match state by document identifier and flush to disk - #344
Merged
deepin-bot[bot] merged 1 commit intoAug 27, 2026
Merged
Conversation
Extract PDF /ID as a stable document identifier and use it to match saved reading state after rename/move. Add Database::flushToDisk and fsync on PDF save for crash durability. 提取 PDF /ID 作为稳定文档标识,用于改名/移动后匹配阅读状态; 新增 Database::flushToDisk 及 PDF 保存 fsync,提升崩溃持久性。 Log: 按文档标识匹配阅读状态并增加刷盘持久化 PMS: BUG-390571 Influence: 文件改名/移动后仍能恢复阅读状态;书签与进度保存更可靠。
Reviewer's GuideThe PR adds stable PDF /ID-based reading-state recovery across renames and moves, with content-hash fallback and bookmark/path migration, while improving persistence durability through PDF fsync, SQLite WAL/FULL synchronization, and an explicit database flush API. Sequence diagram for document state recovery after rename or movesequenceDiagram
participant File as PDF file
participant Renderer as SheetRenderer
participant PDF as PDFDocument
participant DB as Database
File->>Renderer: fileIdentifier()
Renderer->>PDF: fileIdentifier()
PDF-->>Renderer: permanent PDF /ID
Renderer-->>DB: docId
DB->>DB: SELECT operation WHERE docId = :docId
alt docId match
DB->>DB: load saved reading state
DB->>DB: UPDATE operation filePath
DB->>DB: UPDATE bookmark filePath
else no docId match
DB->>DB: computeContentHash(filePath)
DB->>DB: SELECT operation WHERE fileSize = :fileSize AND contentHash = :contentHash
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
lzwind
approved these changes
Aug 27, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extract PDF /ID as a stable document identifier and use it to match saved reading state after rename/move. Add Database::flushToDisk and fsync on PDF save for crash durability.
提取 PDF /ID 作为稳定文档标识,用于改名/移动后匹配阅读状态;
新增 Database::flushToDisk 及 PDF 保存 fsync,提升崩溃持久性。
Log: 按文档标识匹配阅读状态并增加刷盘持久化
PMS: BUG-390571
Influence: 文件改名/移动后仍能恢复阅读状态;书签与进度保存更可靠。
Summary by Sourcery
Preserve document state across file relocation and strengthen persistence against crashes.
New Features:
Bug Fixes:
Enhancements: