Add S3 VFS backend: VfsBackend impl for S3-compatible storage
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

- S3Vfs with all 15 VfsBackend methods via rusty-s3 + ureq
- S3VfsFile for buffered writes + ranged reads
- AWS Signature V4 pre-signed URLs (rusty-s3)
- ListObjectsV2 for directory listing (prefix + delimiter)
- Path-style URL mapping (/path to bucket/key)
This commit is contained in:
Warren
2026-06-18 23:44:52 +08:00
parent 69efcdf5c5
commit 960ee87ce9
5 changed files with 829 additions and 7 deletions

View File

@@ -1353,14 +1353,60 @@ PUBKEY_OK # ✅ Public key authentication successful
**推送到**:✅ m5max128gitea + ✅ m4minigitea
## S3 VFS 後端完成2026-06-18⭐⭐⭐⭐⭐
**完成時間**:約 1 小時
**新增代碼量**~500 行
**新增依賴**rusty-s3 + ureq + url
### 實施內容 ⭐⭐⭐⭐⭐
**S3Vfs 完整實現**`markbase-core/src/vfs/s3_fs.rs`
| VfsBackend 方法 | S3 對應操作 | 狀態 |
|----------------|------------|------|
| `read_dir()` | ListObjectsV2 (prefix + delimiter) | ✅ |
| `open_file()` | GetObject (ranged reads) / PutObject (buffered writes) | ✅ |
| `stat()` / `lstat()` | HeadObject | ✅ |
| `create_dir()` | PutObject (0-byte directory marker) | ✅ |
| `create_dir_all()` | 遞迴建立目錄標記 | ✅ |
| `remove_dir()` | DeleteObject + 空目錄檢查 | ✅ |
| `remove_file()` | DeleteObject | ✅ |
| `rename()` | CopyObject + DeleteObject | ✅ |
| `exists()` | HeadObject (file + directory marker) | ✅ |
| `hard_link()` | CopyObject | ✅ |
| `real_path()` | HeadObject 驗證 | ✅ |
| `set_stat()` / `read_link()` / `create_symlink()` | ❌ 回傳 Unsupported | ✅ |
### 關鍵設計決策 ⭐⭐⭐⭐⭐
**簽名方式**:使用 `rusty-s3` crate 產生 AWS Signature V4 預簽名 URL有效期 1h
**S3VfsFile 實作**
- **讀取模式**Ranged GET`Range` header 指定 byte 範圍)
- **寫入模式**:記憶體緩衝區 → `flush()` 或 `drop()` 時 PUT 上傳
- **seek()**:支援 SeekFrom::Start/End/Current
**路徑映射**
- `/foo/bar.txt` → S3 Key `foo/bar.txt`
- `/foo/bar/` → S3 Key `foo/bar/`(目錄標記)
- 使用 path-style URL`endpoint/bucket/key`
**XML 解析**:使用 `rusty-s3` 內建 `ListObjectsV2::parse_response()`,無需額外 XML parser
### Build 驗證 ✅
```bash
cargo build -p markbase-core # ✅ 0 error
```
---
### 下一步建議
1. **S3 VFS 後端實作**S3Vfs 實作 `VfsBackend` trait
2. **SFTP 認證整合 DataProvider**`sftp/auth.rs` + `sftp/server.rs`
3. **Web 前端 Phase 2**Tab 切換、搜索框 UI
4. **安全審計 Phase 9** — 全面 SSH 安全測驗
5. **CI Pipeline** — 自動化整合測試
6. **效能測試**VFS + AES-CTR throughput profiling
1. **SFTP 認證整合 DataProvider**`sftp/auth.rs` + `sftp/server.rs`
2. **Web 前端 Phase 2** — Tab 切換、搜索框 UI
3. **安全審計 Phase 9**全面 SSH 安全測驗
4. **CI Pipeline** — 自動化整合測試
5. **效能測試**VFS + AES-CTR throughput profiling