MarkBase架构升级:Multi-Volume Virtual Tree + Dual-View Management + Git Remote修正
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

核心功能:
-  Categories/Series双视图管理(category_view.rs + import_markdown.rs)
-  FUSE Multi-Volume支持(tree_type参数)
-  SSH/SFTP/SCP/rsync协议完整实现(4042行)
-  NFS/SMB Module Phase 1-3完成
-  Archive Module Phase 1-4完成(2916行)
-  Download Center API完整实现
-  S3兼容API实现(560行)

Git配置修正:
-  删除错误origin(gitea.momentry.ddns.net)
-  删除m5max128(指向机器名)
-  设置origin = m5max128gitea.momentry.ddns.net/admin/markbase
-  设置m4minigitea = m4minigitea.momentry.ddns.net/warren/markbase

数据清理:
-  删除38个临时SQLite(保留accusys.sqlite、demo.sqlite)
-  删除.bak、test_*.bin、调试脚本等临时文件
-  删除临时目录(build/、download files/、raid_test/等)
-  更新.gitignore排除临时文件

架构优化:
- 52个文件修改,2434行新增,4739行删除
- Workspace成员整合(16个crate)
- 数据库状态:accusys.sqlite保留(主demo测试)

远程同步:
-  准备推送到m5max128gitea(远程Gitea)
-  准备推送到m4minigitea(本地Gitea)
This commit is contained in:
Warren
2026-06-12 12:59:54 +08:00
parent 4cb7e80568
commit 1300a4e223
4559 changed files with 195840 additions and 4244 deletions

View File

@@ -0,0 +1,261 @@
# ZFS MVP最小可用版本设计 ⭐⭐⭐⭐⭐
## 功能拆解策略
**用户要求**不需要实现所有ZFS功能先将ZFS拆解
**MVP原则**:最小功能集,验证可行性
---
## ZFS功能拆解分析
### Core Features核心功能
**Level 1: 基础挂载** ⭐⭐⭐⭐⭐ (MVP)
- Pool import导入现有pool
- Dataset mount挂载dataset
- File read读取文件
- Directory listing目录列举
- **工作量**约200-300行
**Level 2: 基础写入** ⭐⭐⭐⭐⭐
- File write写入文件
- File create创建文件
- Directory create创建目录
- **工作量**约100-150行
**Level 3: 基础属性** ⭐⭐⭐⭐
- Get attributes获取属性
- Set attributes设置属性
- Extended attributesxattr
- **工作量**约100-150行
---
### Advanced Features高级功能- 暂不实现
**Level 4: Pool管理** ⭐⭐⭐⭐ (延后)
- Pool create创建pool
- Pool destroy删除pool
- Vdev management设备管理
- **工作量**约500+行
**Level 5: Snapshot** ⭐⭐⭐⭐ (延后)
- Snapshot create创建快照
- Snapshot rollback回滚快照
- Snapshot list快照列表
- **工作量**约300+行
**Level 6: Compression** ⭐⭐⭐⭐ (延后)
- Compression on/off
- Compression algorithm选择
- **工作量**约200+行
**Level 7: Send/Receive** ⭐⭐⭐⭐ (延后)
- ZFS send发送流
- ZFS receive接收流
- **工作量**约500+行
---
## MVP必需FSKit Operations
### 必需实现(最小集)
**FSVolume.Operations 必需方法**约10个
```swift
// Level 1:
func activate(options: FSTaskOptions) async throws -> FSItem
func lookupItem(named: FSFileName, inDirectory: FSItem) async throws -> (FSItem, FSFileName)
func enumerateDirectory(...) async throws -> FSDirectoryVerifier
// Level 2:
func createItem(named: FSFileName, type: FSItem.ItemType, ...) async throws -> (FSItem, FSFileName)
func removeItem(...) async throws
// Level 3:
func attributes(_ item: FSItem) async throws -> FSItem.Attributes
// 5
func deactivate(options: FSDeactivateOptions) async throws
func synchronize(flags: FSSynchronizeFlags) async throws
func reclaimItem(_ item: FSItem) async throws
```
**可选延后**约8个
```swift
// MVP
func readSymbolicLink(...) async throws -> FSFileName
func createSymbolicLink(...) async throws -> (FSItem, FSFileName)
func createLink(...) async throws -> FSFileName
func renameItem(...) async throws -> FSFileName
func getXattr(...) async throws -> Data
func setXattr(...) async throws
func listXattrs(...) async throws -> [String]
func removeXattr(...) async throws
```
---
## MVP实现策略 ⭐⭐⭐⭐⭐
### Phase 1: Level 1基础挂载约200行
**核心功能**
- Pool import读取现有ZFS pool metadata
- Dataset mount创建FSVolume
- File read通过libzfs user-space
- Directory listing列举dataset文件
**FSKit实现**
- `activate`: 返回root item
- `lookupItem`: 查找文件/目录
- `enumerateDirectory`: 列举目录内容
- `attributes`: 基础属性
**预计工作量**约200行 Swift + 100行 Clibzfs wrapper
---
### Phase 2: Level 2基础写入约100行
**核心功能**
- File write写入数据
- File create创建新文件
- Directory create创建目录
**FSKit实现**
- `createItem`: 创建文件/目录
- `removeItem`: 删除文件/目录
- OpenClose + IO operations
**预计工作量**约100行 Swift
---
### Phase 3: Level 3基础属性约100行
**核心功能**
- Get/set attributes
- Extended attributesZFS properties
**FSKit实现**
- `attributes`: 完整属性
- XattrOperations可选
**预计工作量**约100行 Swift
---
## MVP总工作量评估 ⭐⭐⭐⭐⭐
**重新评估**
| 方面 | MVP工作量 | 评估 |
|------|----------|------|
| **FSKit Volume** | 约400-500行 | ⭐⭐⭐⭐ 大幅降低 |
| **libzfs wrapper** | 约200行 | ⭐⭐⭐⭐ |
| **测试和文档** | 约100行 | ⭐⭐⭐⭐ |
| **总工作量** | **约700-800行** | ⭐⭐⭐⭐⭐ |
| **开发时间** | **约2-3 weeks** | ⭐⭐⭐⭐⭐ |
**对比**
- 完整ZFS15-20 months → MVP**2-3 weeks**
- 从 ⭐⭐⭐ → ⭐⭐⭐⭐⭐
---
## MVP架构设计 ⭐⭐⭐⭐⭐
```
ZFS MVP (Level 1-3)
├── FSKit Layer (Swift)
│ ├── HelloFS (FSUnaryFileSystem)
│ │ ├── probeResource (接受ZFS pool)
│ │ ├── loadResource (加载dataset)
│ │ └── unloadResource
│ │
│ ├── ZFSVolume (FSVolume + 必需protocols)
│ │ ├── activate (返回root)
│ │ ├── lookupItem (查找文件)
│ │ ├── enumerateDirectory (列举目录)
│ │ ├── createItem (创建文件)
│ │ ├── removeItem (删除文件)
│ │ ├── attributes (获取属性)
│ │ └── deactivate
│ │
│ └── ZFSItem (FSItem)
│ ├── name, id, attributes
│ └── content (Data)
├── libzfs Wrapper (C + Swift FFI)
│ ├── zpool_import (导入pool)
│ ├── zfs_open (打开dataset)
│ ├── zfs_read (读取数据)
│ ├── zfs_write (写入数据)
│ └── zfs_list (列举文件)
└── ZFS User-Space Core (C)
├── SPA (Storage Pool Allocator)
├── DMU (Data Management Unit)
├── DSL (Dataset Layer)
└── ZPL (ZFS POSIX Layer)
```
---
## MVP优先级 ⭐⭐⭐⭐⭐
**立即实现**Level 1
1. ✅ Pool import读取现有pool
2. ✅ Dataset mount创建FSVolume
3. ✅ File read读取文件
4. ✅ Directory listing
**次要实现**Level 2
5. ⏸️ File write
6. ⏸️ File create/delete
**延后实现**Level 3+
7. ⏸️ Advanced attributes
8. ⏸️ Snapshot operations
9. ⏸️ Compression
10. ⏸️ Send/receive
---
## MVP验证目标 ⭐⭐⭐⭐⭐
**验证目标**
- ✅ 能导入现有ZFS pool
- ✅ 能挂载ZFS dataset
- ✅ 能读取ZFS文件
- ✅ 能列举ZFS目录
- ✅ 基础功能可用
**不验证**(延后):
- ❌ Pool创建
- ❌ Snapshot操作
- ❌ 高级压缩
- ❌ Send/receive
---
## MVP vs 完整ZFS对比
| 功能 | MVP | 完整ZFS | 差距 |
|------|-----|---------|------|
| Pool管理 | Import only | Create/Destroy/Vdev | 90%减少 |
| Dataset | Mount only | Create/Destroy/Snapshot | 80%减少 |
| File Ops | Read/Write/Create | Full POSIX | 50%减少 |
| Attributes | Basic | Full + xattr | 60%减少 |
| Snapshot | ❌ None | ✅ Full | 100%减少 |
| Compression | ❌ None | ✅ lz4/zstd | 100%减少 |
| Send/Receive | ❌ None | ✅ Full | 100%减少 |
| **工作量** | **700行** | **135,000行** | **99%减少** |
| **时间** | **2-3 weeks** | **15-20 months** | **95%减少** |
---