Update AGENTS.md: SMB VFS features complete (set_len, set_stat, streaming write, CLI)
This commit is contained in:
104
AGENTS.md
104
AGENTS.md
@@ -2948,3 +2948,107 @@ cargo build -p markbase-core # ✅ 0 error (no feat
|
||||
```
|
||||
|
||||
**版本**:1.34(SMB Server Phase 2 Build Fix)
|
||||
|
||||
---
|
||||
|
||||
## SMB VFS 功能完成(2026-06-20)⭐⭐⭐⭐⭐
|
||||
|
||||
**完成时间**:约 2 小时
|
||||
**新增代码量**:311 行 + 85 行(CLI)
|
||||
**Git commits**:`51ca0c4`, `d1467f0`, `3986fb2`
|
||||
|
||||
### 实施内容 ⭐⭐⭐⭐⭐
|
||||
|
||||
| 功能 | 状态 | 实现方式 |
|
||||
|------|------|---------|
|
||||
| `set_len()` | ✅ 完成 | SMB SET_INFO compound (FileEndOfFileInformation class 14) |
|
||||
| `set_stat()` | ✅ 完成 | SMB SET_INFO compound (FileBasicInformation class 4) for timestamps |
|
||||
| **Streaming write** | ✅ 完成 | `Tree::create_file_writer` + `FileWriter::write_chunk` / `finish` |
|
||||
| `auto_reconnect` | ✅ 完成 | `ClientConfig.auto_reconnect = true` (new_with_options param) |
|
||||
| **Multi-user CLI** | ✅ 完成 | `--user name:password` (repeatable) |
|
||||
| **S3 VFS backend** | ✅ 完成 | `--s3 --s3-endpoint --s3-bucket --s3-access-key --s3-secret-key` |
|
||||
| Streaming read | ❌ Deferred | `FileDownload<'a>` lifetime incompatible with `SmbVfsFile` |
|
||||
| SMB3 encryption | ❌ N/A | smb-server v1 limitation (AES-CCM/GCM out of scope) |
|
||||
|
||||
### 关键实现 ⭐⭐⭐⭐⭐
|
||||
|
||||
**set_len() compound**(smb_fs.rs):
|
||||
```rust
|
||||
CREATE → SET_INFO (FileEndOfFileInformation, size as 8-byte LE) → CLOSE
|
||||
```
|
||||
|
||||
**set_stat() compound**(smb_fs.rs):
|
||||
```rust
|
||||
CREATE → SET_INFO (FileBasicInformation, 40-byte buffer: creation/access/write/change times + attributes) → CLOSE
|
||||
```
|
||||
|
||||
**Streaming write**(smb_fs.rs):
|
||||
```rust
|
||||
// On first write, create FileWriter
|
||||
let tree_arc = Arc::new(self.tree.clone());
|
||||
let conn = client.connection_mut().clone();
|
||||
let writer = tree_arc.create_file_writer(conn, &path)?;
|
||||
self.file_writer = Some(writer);
|
||||
|
||||
// write() → write_chunk()
|
||||
writer.write_chunk(buf)?;
|
||||
|
||||
// flush() → finish()
|
||||
writer.finish()?;
|
||||
```
|
||||
|
||||
### CLI 使用示例 ⭐⭐⭐⭐⭐
|
||||
|
||||
**本地文件系统**(默认):
|
||||
```bash
|
||||
cargo run --features smb-server -- smb-start \
|
||||
--port 4445 \
|
||||
--share-name myshare \
|
||||
--root /path/to/data \
|
||||
--user alice:pass1 --user bob:pass2
|
||||
```
|
||||
|
||||
**S3 VFS 后端**:
|
||||
```bash
|
||||
cargo run --features smb-server -- smb-start \
|
||||
--s3 \
|
||||
--s3-endpoint https://s3.amazonaws.com \
|
||||
--s3-bucket mybucket \
|
||||
--s3-access-key AKIAIOSFODNN7EXAMPLE \
|
||||
--s3-secret-key wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY \
|
||||
--s3-region us-east-1 \
|
||||
--root demo/ \
|
||||
--share-name s3share
|
||||
```
|
||||
|
||||
### 测试验证 ✅
|
||||
|
||||
```bash
|
||||
cargo build -p markbase-core --features smb-server # ✅ 0 error
|
||||
cargo test -p markbase-core --lib --features smb-server # ✅ 229 passed, 0 failed
|
||||
```
|
||||
|
||||
### 相关文件
|
||||
|
||||
**修改文件**:
|
||||
```
|
||||
markbase-core/src/vfs/smb_fs.rs (+311 lines)
|
||||
├── systemtime_to_filetime() helper
|
||||
├── SmbVfs::new_with_options(auto_reconnect param)
|
||||
├── SmbVfsFile::set_len() compound
|
||||
├── SmbVfsFile::set_stat() compound
|
||||
├── SmbVfsFile::file_writer: Option<FileWriter>
|
||||
├── SmbVfsFile::write() streaming
|
||||
├── SmbVfsFile::flush() FileWriter::finish()
|
||||
└── SmbVfsFile::drop() cleanup
|
||||
|
||||
markbase-core/src/cli/tools/smb_server.rs (+85 lines)
|
||||
├── --user name:password (repeatable)
|
||||
├── --s3 flag + endpoint/bucket/credentials params
|
||||
└── S3Vfs backend integration
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**最后更新**:2026-06-20
|
||||
**版本**:1.35(SMB VFS 功能完成)
|
||||
|
||||
Reference in New Issue
Block a user