Library: every Home folder writer takes the Library lock

未關閉
#488 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
30/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
rust
領域
backend, database

研究方向

Start by tracing the Library lock and the writer paths named in the issue: the localhost provider and IPFS writes, activation and rollback encryption, and first-read encryption. Then trace the listed handlers and confirm whether update activation stops Runtime before migration. Done means tests show each writer waits for a Library move without losing acknowledged saves, Mac and Linux checks pass with two clients, and independent review passes.

由索引模型根據 Issue 內容生成。

描述

Goal

Every writer that changes files in a Home folder takes the same Library lock as Library, so a Library move, copy or save never overlaps another writer's save.

Where #480 stops

#480 puts these writers under one lock, shared by Runtime and the object-provider process: Library changes, uploads, Documents, viewer storage saves, publish records, and capsule writes to protected Home folders. Library also refuses to change app folders (.AppData, BrowserProfiles) and hides them at the top of the Library.

The writers below still change files in Home folders that Library can change, without that lock:

  • B. localhost provider. Write, append, delete and new-folder requests reach the localhost-provider capsule from the capsule resource bridge (writes when the Home folder is not protected; delete and new folder always) and from the /api/provider/localhost proxy. The IPFS cat_to_path and download_directory operations can also write under Users/.
  • C. Encryption at Profile setup and recovery. migrate_principal_root_plaintext_objects_under_activation and the journal rollback restore_journal_plaintext_object replace Library files while Home runs, under the object mutex and lifecycle lock only.
  • D. First-read encryption of older plaintext Library files. protect_legacy_plaintext_principal_root_object, reached from Library reads in both processes, reads, encrypts and writes back without the lock. This overlaps #450.

Also confirm: the update activation path (acquire_principal_root_update_lock) stops Runtime before it migrates Home folders; and trace the handlers the #480 inventory did not reach (inbox_action, System AI provider, approval lens and community, capsule_interface_invoke, Home launch, the home-cli renderer child).

Proposed change (about 100 lines plus tests)

  • B: Runtime takes the Library lock around forwarding write, append, delete and new-folder requests for Users/ paths, protected or not; refuse or lock IPFS destinations under Users/.
  • C: the activation guards take the Library lock before the object mutex.
  • D: first-read encryption takes the Library lock when its caller does not already hold it (a per-thread marker keeps locked Library operations from waiting on themselves).

Done when

  • A test for each writer shows that it waits for a Library move and that no acknowledged save is lost (fail-before first).
  • An installed Mac and Linux check with two clients passes.
  • Independent review passes.

Related: #480, #450.

主要語言
Rust
星號
6
分支
2
平均合併
1 天 3 小時
30 天內合併 PR
42

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

elastos/elastos-runtime 的其他 Issue

查看 elastos/elastos-runtime 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。