Skip to content

refactor(files): File Management System Architecture#12150

Draft
EurFelux wants to merge 5 commits intov2from
v2-file-manager
Draft

refactor(files): File Management System Architecture#12150
EurFelux wants to merge 5 commits intov2from
v2-file-manager

Conversation

@EurFelux
Copy link
Copy Markdown
Collaborator

@EurFelux EurFelux commented Dec 26, 2025

概要设计

架构

  • 单一节点表node 表统一表达 file/dir/mount,邻接表树结构
  • 双模式存储
    • local_managed(Files):UUID 命名,DB 为 SoT
    • local_external(Notes):人类可读命名,文件系统为 SoT
    • remote(未来):远程 API + 本地缓存
  • 显式引用file_ref 表追踪文件被哪些业务对象引用(多态:sourceType + sourceId)

关键设计

  • OS 风格 Trash:移动到 Trash 目录 + previousParentId 记录原位置
  • 三层引用清理:nodeId CASCADE → 业务删除钩子 → 注册式孤儿扫描器
  • 跨 Provider 引用:远程文件下载到 managed mount 作为本地副本,通过 file_ref 追踪

数据模型

核心字段
node id, type(file/dir/mount), name, ext, parentId, mountId, providerConfig, remoteId, isCached, previousParentId
file_ref nodeId, sourceType, sourceId, role

实施阶段

  1. Schema & Foundation
  2. Core Services + API
  3. FileMigrator (order=2.5, ID 保持不变,物理文件不移动)
  4. Consumer Migration (4 批,274 处 FileMetadata 引用)
  5. Notes Integration
  6. Cleanup

风险

  • FileMetadata 引用面广(274 处)→ toFileMetadata() 适配层过渡
  • Painting 不在本次范围 → 随业务重构独立推进

完整 RFC: docs/file-manager/rfc-file-manager.md

@EurFelux EurFelux added the v2 label Dec 26, 2025
@EurFelux EurFelux marked this pull request as draft December 26, 2025 12:02
@EurFelux EurFelux force-pushed the v2-file-manager branch 3 times, most recently from ef093a0 to 52b4207 Compare December 26, 2025 12:18
@0xfullex
Copy link
Copy Markdown
Member

0xfullex commented Dec 26, 2025

Note

This comment was translated by Claude.

  • The docs directory in the repository should only store definitive documentation for developers after release, not design-phase documents
  • RFC + overview design documents can be listed in the PR description as PR archives; please keep them concise and precise
  • Currently no clear design document is visible; please consider adding one

Original Content
  • 仓库的docs目录只存放上线后的给开发者参考的确定性文档,不存放设计阶段文档
  • RFC+概要设计文档,可以在PR正文中列出,作为PR存档,注意精炼精准
  • 当前未见清晰的设计文档,可以补充下

@eeee0717
Copy link
Copy Markdown
Collaborator

eeee0717 commented Feb 7, 2026

Note

This comment was translated by Claude.

Any updates on this?


Original Content

这个有什么进展吗🤔

@EurFelux
Copy link
Copy Markdown
Collaborator Author

EurFelux commented Feb 7, 2026

Note

This comment was translated by Claude.

Any updates on this?

Let's move this forward.


Original Content

Any updates on this?

近期推进一下

Add comprehensive documentation covering:
- VS Code explorer tree implementation overview
- Current notes file tree implementation
- Existing file architecture problems
- Current file management implementation details
- RFC for new file manager design (single node table + file tree)

These documents provide technical reference and design context for the file management system, highlighting current issues and proposed solutions.
@EurFelux
Copy link
Copy Markdown
Collaborator Author

EurFelux commented Feb 7, 2026

@0xfullex design doc is ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants