Session修改:Mutex死锁修复+AGENTS更新

This commit is contained in:
Warren Lo
2026-05-18 17:02:30 +08:00
parent 8589a02042
commit 14863d323e
41 changed files with 10152 additions and 28 deletions

181
AGENTS.md
View File

@@ -1050,9 +1050,186 @@ curl http://localhost:11438/api/v2/config/validate
---
**最后更新:** 2026-05-16 20:35
**版本:** 1.6UI Settings系统版
## FUSE Virtual File System2026-05-17新增
### 功能概述
**虚拟文件系统挂载:**
- FUSE-T技术Kext-less设计
- Backend选择NFSv4稳定或FSKitmacOS 26+,最快)
- 支持多用户并发挂载10 users
- 性能目标600MB/s sustained write per user
### 设计文档
**架构概览:**
```
MarkBase FUSE System
├── src/fuse/mod.rs # FUSE核心模組
│ ├── BackendType # NFSv4/FSKit选择
│ ├── select_backend() # 自动检测backend
│ └── mount_hello_fs() # POC placeholder
├── docs/FUSE_DESIGN.md # 完整设计文档
└ docs/FUSE_POC_TEST.md # POC测试计划
```
**Backend选择逻辑**
- macOS 26+FSKitnativedirect pathminimal overhead
- macOS <26NFSv4stableTCP/IP overhead ~5-10%
### CLI命令
**POC测试命令**
```bash
# 检测backend
cargo run -- fuse detect-backend
# 输出macOS 26.4.1 → Recommended: fskit
# POC placeholder mount
cargo run -- fuse poc --dir /tmp/fuse_test --backend auto
cargo run -- fuse poc --backend fskit # 手動指定 FSKit
cargo run -- fuse poc --backend nfs # 手動指定 NFSv4
```
**未来完整命令Phase 2+**
```bash
# 单user挂载
cargo run -- fuse --mount --user warren --dir /Volumes/MarkBase_warren
# 多user并发挂载
cargo run -- fuse --mount --all --dir /Volumes/
# 卸載
cargo run -- fuse --unmount --dir /Volumes/MarkBase_warren
cargo run -- fuse --unmount --all
```
### POC测试结果2026-05-17
**测试环境:**
- 硬體M4 Mac mini, 16GB RAM, NVMe 2TB
- OSmacOS 26.4.1
- BackendFSKit自动检测
**测试項目7項全通過**
- ✅ Backend detectionmacOS 26.4.1 → FSKit
- ✅ Auto backend selectionFSKit
- ✅ Manual backend selectionFSKit/NFSv4
- ✅ Error handlinginvalid backend
- ✅ Compilation check
- ✅ Unit tests7 passed
- ✅ CLI commands functional
**Unit Tests结果**
```
running 7 tests
test fuse::backend::tests::test_backend_support ... ok
test fuse::backend::tests::test_backend_type_name ... ok
test fuse::backend::tests::test_manual_backend_selection ... ok
test fuse::poc_hello::tests::test_hello_fs_creation ... ok
test fuse::backend::tests::test_select_backend_macos_25 ... ok
test fuse::poc_hello::tests::test_mount_placeholder ... ok
test fuse::backend::tests::test_select_backend_macos_26 ... ok
test result: ok. 7 passed; 0 failed; 0 ignored
```
### FUSE-T vs macFUSE比較
|特性 |FUSE-T |macFUSE |
|------|--------|---------|
|Kernel Design |Kext-lessuserspace|Kernel Extension + FSKit |
|Backend Protocol |NFSv4 / SMB3 / FSKit |Direct kernel FUSE API |
|安装难度 |简单brew install|需System Settings設定 |
|稳定性 |穩定userspace server|可能kernel crash |
|授權 |免費個人,商業需授權 |開源BSD|
|macOS支援 |全版本 |macOS 12+ |
|App Store |可嵌入 |需特殊處理 |
|效能FSKit |~600-700 MB/s |~650-750 MB/s |
**推薦FUSE-T**
- 稳定性优先避免kernel panic
- 部署友善无需Security Settings
- macOS 26支援FSKit backend与macFUSE相同效能
### 效能目标
|Metric |Target |Measurement Method |
|--------|--------|-------------------|
|Write throughput |>=600MB/s |AJA System Test 4K ProRes 4444 |
|Read throughput |>=800MB/s |AJA System Test 4K ProRes 422 HQ |
|Mount latencysingle |<100ms |Timing measurement |
|Mount latency10 users |<2s |Parallel mount timing |
|Concurrent writes |10 × 600MB/s |AJA concurrent test |
|Uptime stability |24h no crash |Stability test |
|Cache hit rate |>=90% |Cache statistics |
### 实作阶段
**Phase 1POC验证已完成 Day 1**
- ✅ 建立fuse module结构
- ✅ Backend detection implementation
- ✅ CLI commands functional
- ✅ Unit tests pass7 tests
- ⏳ FUSE-T安装需手动sudo
- ⏳ AJA System Test下载需手动
**Phase 2SQLite-backed FUSEDay 3-5**
- ❌ MarkBaseFs implementation
- ❌ FUSE operationsgetattr, read, write
- ❌ warren user test12659 nodes
- ❌ LRU caching
**Phase 3Multi-user ConcurrentDay 6-8**
- ❌ MountManager implementation
- ❌ 10 user parallel mount
- ❌ AJA concurrent write test
- ❌ 24h stability test
**Phase 4Performance OptimizationDay 9-12**
- ❌ Write buffering64KB chunks
- ❌ FSKit backend optimization
- ❌ 600MB/s validation
- ❌ Final documentation
### 手动安装步骤
**FUSE-T安装**
```bash
# 检查下载的PKG
ls -lh ~/Downloads/fuse-t-1.2.6.pkg # 23MB
# 安装需要sudo密码
sudo installer -pkg ~/Downloads/fuse-t-1.2.6.pkg -target /
# 验证安装
ls -la /usr/local/bin/fuse-t
fuse-t --version # Expected: 1.2.6
```
**AJA System Test安装**
```bash
# 手动下载(浏览器访问)
https://www.aja.com/en/products/aja-system-test
# 安装DMG
hdiutil attach ~/Downloads/AJA_System_Test.dmg
cp -R /Volumes/AJA\ System\ Test/*.app /Applications/
hdiutil detach /Volumes/AJA\ System\ Test
```
### 相关文档
|文档 |位置 |说明 |
|------|------|------|
|FUSE_DESIGN.md |docs/ |完整设计文档架构、backend、性能|
|FUSE_POC_TEST.md |docs/ |POC测试计划7项测试|
|FUSE_POC_REPORT.md |docs/ |POC测试报告结果、下一步|
|fuse_poc_test.sh |tests/ |自动化测试脚本 |
---
**最后更新:** 2026-05-17 10:20
**版本:** 1.8FUSE Virtual File System版
---
## File Scan System2026-05-17新增