Files
markbase/docs/fskit-research/ZFS_MVP_OPERATIONS.md
T
Warren 1300a4e223
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
MarkBase架构升级:Multi-Volume Virtual Tree + Dual-View Management + Git Remote修正
核心功能:
-  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)
2026-06-12 12:59:54 +08:00

199 lines
4.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ZFS MVP FSKit Operations 清单 ⭐⭐⭐⭐⭐
## Level 1: 基础挂载和读取(约200行)
### 必需实现(6个核心方法)
```swift
// 1. Volume激活 - 返回root item
func activate(options: FSTaskOptions) async throws -> FSItem {
// 返回ZFS dataset的root目录
return rootItem
}
// 2. 文件查找 - lookup文件/目录
func lookupItem(
named name: FSFileName,
inDirectory directory: FSItem
) async throws -> (FSItem, FSFileName) {
// 调用libzfs查找文件
// 返回找到的item和名称
}
// 3. 目录列举 - enumerate目录内容
func enumerateDirectory(
_ directory: FSItem,
startingAt cookie: FSDirectoryCookie,
verifier: FSDirectoryVerifier,
attributes: FSItem.GetAttributesRequest?,
packer: FSDirectoryEntryPacker
) async throws -> FSDirectoryVerifier {
// 调用libzfs列举目录
// 使用packer添加每个item
}
// 4. 属性获取 - 获取文件属性
func attributes(_ item: FSItem) async throws -> FSItem.Attributes {
// 调用libzfs获取属性
// 返回Attributes对象
}
// 5. Volume同步 - 同步数据
func synchronize(flags: FSSynchronizeFlags) async throws {
// 调用zfs sync
}
// 6. Volume停用 - 停用volume
func deactivate(options: FSDeactivateOptions = []) async throws {
// 清理volume
}
```
---
## Level 2: 基础写入(约100行)
### 必需实现(3个方法)
```swift
// 7. 文件创建 - 创建新文件/目录
func createItem(
named name: FSFileName,
type: FSItem.ItemType,
inDirectory directory: FSItem,
attributes: FSItem.SetAttributesRequest
) async throws -> (FSItem, FSFileName) {
// 调用libzfs创建文件
}
// 8. 文件删除 - 删除文件/目录
func removeItem(
_ item: FSItem,
named name: FSFileName,
fromDirectory directory: FSItem
) async throws {
// 调用libzfs删除文件
}
// 9. Item回收 - 回收资源
func reclaimItem(_ item: FSItem) async throws {
// 清理item资源
}
```
---
## OpenClose + IO Operations(约50行)
```swift
// 10. 打开文件
func open(_ item: FSItem, options: FSTaskOptions) async throws -> FSFileHandle {
// 返回file handle
}
// 11. 关闭文件
func close(_ handle: FSFileHandle) async throws {
// 清理handle
}
// 12. 读取数据
func read(
_ handle: FSFileHandle,
buffer: UnsafeMutableRawBufferPointer,
options: FSTaskOptions
) async throws -> Int {
// 调用libzfs读取数据到buffer
}
// 13. 写入数据
func write(
_ handle: FSFileHandle,
buffer: UnsafeRawBufferPointer,
options: FSTaskOptions
) async throws -> Int {
// 调用libzfs写入buffer数据
}
```
---
## 延后实现(MVP不实现)
**高级功能(8个方法)- Level 3+**:
```swift
// 延后:符号链接
func readSymbolicLink(_ item: FSItem) 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 Operations总清单
**必需实现**:约13个方法
- activate ✅
- lookupItem ✅
- enumerateDirectory ✅
- attributes ✅
- synchronize ✅
- deactivate ✅
- createItem ✅
- removeItem ✅
- reclaimItem ✅
- open ✅
- close ✅
- read ✅
- write ✅
**延后实现**:约8个方法
- readSymbolicLink ❌
- createSymbolicLink ❌
- createLink ❌
- renameItem ❌
- getXattr ❌
- setXattr ❌
- listXattrs ❌
- removeXattr ❌
**总计**:13个必需 + 8个延后 = 21个operations
---
## MVP工作量细分
**Level 16 methods**: 约150行
- activate (20行)
- lookupItem (30行)
- enumerateDirectory (40行)
- attributes (20行)
- synchronize (20行)
- deactivate (20行)
**Level 23 methods**: 约80行
- createItem (30行)
- removeItem (30行)
- reclaimItem (20行)
**OpenClose + IO4 methods**: 约60行
- open (15行)
- close (15行)
- read (15行)
- write (15行)
**总计**:约290行 Swift + 约200行 C wrapper = 约490行
---