Commit Graph

16 Commits

Author SHA1 Message Date
Warren
4afd96c9ac Implement VFS RAID-Z (software RAID)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add VfsRaidLevel enum:
  - Single (no RAID)
  - RaidZ1 (single parity, similar to RAID 5)
  - RaidZ2 (double parity, similar to RAID 6)
  - RaidZ3 (triple parity)
- Add VfsRaidBackend with:
  - Stripe-based data distribution across disks
  - Galois Field arithmetic for parity (P/Q/R)
  - gf_exp, gf_mul for Reed-Solomon coding
  - rebuild_disk() for disk recovery
- Add VfsRaidConfig:
  - level (RAID level)
  - stripe_size (default 64KB)
  - disk_paths (storage devices)
- All VfsBackend methods propagate to all disks
- Foundation for ZFS-style software RAID

All 229 tests pass.
2026-06-20 23:17:00 +08:00
Warren
37f5da7d6c Implement VFS Deduplication (block-level)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add DedupStore with content-addressable storage:
  - SHA-256 hash-based block storage
  - Reference counting for block lifecycle
  - dedup_file() and restore_file() operations
  - DedupManifest for file reconstruction
  - DedupStats for storage statistics
- Add VfsDedupConfig:
  - block_size (default 4KB)
  - min_file_size threshold
  - store_path for dedup directory
- Add hex crate for hash encoding
- Block-level dedup foundation for SMB/ZFS

All 229 tests pass.
2026-06-20 22:39:25 +08:00
Warren
1ca4913291 Implement SMB ACLs (NFSv4) at VFS layer
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add ACL structures:
  - VfsAceType (Allow/Deny/Audit/Alarm)
  - VfsAceFlag (inheritance flags)
  - VfsAceMask (permission masks)
  - VfsAce (access control entry)
  - VfsAcl (ACL list with default_acl)
- Add VfsBackend methods:
  - get_acl() - retrieve ACL from .acl JSON
  - set_acl() - store ACL as .acl JSON
  - check_acl() - check permission for principal
  - add_ace() - add ACE to ACL
  - remove_ace() - remove ACE by index
- LocalFs implementation:
  - VfsAclMeta serialization struct
  - ACL stored as JSON metadata (similar to quota/snapshot)
  - Box<VfsAcl> for recursive default_acl
- Foundation for SMB/NFSv4 ACL support

All 229 tests pass.
2026-06-20 22:33:03 +08:00
Warren
837ffa923d Implement SMB Previous versions (shadow copy) at VFS layer
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add VfsPreviousVersion struct (snapshot_name, gmt_token, created, size)
- Add VfsBackend methods:
  - list_previous_versions() - enumerate snapshot versions
  - open_previous_version() - open file from snapshot by GMT token
  - restore_previous_version() - restore file from snapshot
- LocalFs implementation:
  - systemtime_to_gmt_token() - convert SystemTime to @GMT-YYYY.MM.DD-HH.MM.SS
  - scan .snapshots directory for matching versions
  - use existing restore_snapshot() for restoration
- Foundation for SMB shadow copy (@GMT- token support)

All 229 tests pass.
2026-06-20 22:26:58 +08:00
Warren
70cc6d9921 Implement VFS compression support (ZSTD)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add VfsCompression and VfsCompressionConfig types
- Add compression module with Compressor:
  - compress/decompress methods
  - compress_file/decompress_file utilities
  - should_compress threshold check
  - extension detection (.zst, .lz4)
- Add zstd crate dependency
- LZ4 placeholder (future implementation)

Enables SMB transparent compression.

All 229 tests pass.
2026-06-20 22:21:50 +08:00
Warren
9c44bd5929 Implement VFS quota support
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add VfsQuota and VfsQuotaUsage structs
- Add quota methods to VfsBackend trait:
  - set_quota: set space/file limits
  - get_quota: retrieve quota settings
  - get_quota_usage: current usage stats
  - check_quota: pre-write check
- Implement LocalFs quota support:
  - Uses .quota metadata file
  - JSON storage for quota limits
  - Recursive size/file counting
  - Hidden files excluded (.quota, .snapshots)

Enables SMB per-share/user quota enforcement.

All 229 tests pass.
2026-06-20 22:17:50 +08:00
Warren
f016525687 Implement VFS snapshot support (ZFS-style)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add VfsSnapshotInfo struct
- Add snapshot methods to VfsBackend trait:
  - create_snapshot: copy-on-write with metadata
  - list_snapshots: enumerate snapshots
  - delete_snapshot: remove snapshot and metadata
  - restore_snapshot: restore from snapshot
  - snapshot_info: get snapshot metadata
- Implement LocalFs snapshot support:
  - Uses .snapshots directory for storage
  - JSON metadata files (*.meta)
  - Recursive directory copy
  - Size calculation

This enables SMB 'Previous versions' feature foundation.

All 229 tests pass.
2026-06-20 22:13:17 +08:00
Warren
7b033e5276 Implement SMB streaming read using chunked READ requests
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add file_id and read_chunk_size fields to SmbVfsFile
- Use Tree::open_file() to get file_id for reads
- Issue READ requests on each read() call (64KB chunks)
- Close file handle in Drop

Benefits:
- No memory overhead for large files
- Read-ahead caching possible
- Compatible with SMB2 protocol

All 229 tests pass.
2026-06-20 21:24:55 +08:00
Warren
dbca6e6d35 Fix clippy warnings: unused imports, minor style fixes
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
2026-06-20 21:08:50 +08:00
Warren
51ca0c4633 SMB VFS: Add set_len, set_stat, streaming write, auto_reconnect
Some checks failed
Test / build (push) Has been cancelled
Test / test (push) Has been cancelled
- set_len() via SMB SET_INFO compound (CREATE → SET_INFO → CLOSE)
  with FileEndOfFileInformation (class 14)
- set_stat() via SMB SET_INFO compound with FileBasicInformation (class 4)
  for timestamp updates (atime, mtime)
- Streaming write using Tree::create_file_writer + FileWriter::write_chunk
  + finish for pipelined uploads
- Add file_writer: Option<FileWriter> to SmbVfsFile for streaming state
- Enable auto_reconnect by default (new_with_options param)
- Add systemtime_to_filetime helper for timestamp conversion

All 229 tests pass.
2026-06-20 20:26:35 +08:00
Warren
8a85c2ef7c SMB comprehensive unit tests (229 passed, 0 failed)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
smb_server_backend.rs tests (+135 lines):
- Full VfsHandle lifecycle: file create/write/read/flush/close, stat,
  truncate (zero + extend), set_times, list_dir error, write past end
- Directory: create/stat/list/close, contains-created-file, read/write/truncate
  error cases
- All OpenIntent variants: Create (new + existing fail), OpenOrCreate
  (new + existing), OverwriteOrCreate (new + truncate existing), Truncate
  (existing + nonexistent fail)
- Directory OpenIntent: Create (new + existing fail), Open (existing),
  OpenOrCreate (new + existing)
- non_directory flag on dir (IsDirectory), directory flag on file (NotADirectory)
- Unlink: file, directory, nonexistent (NotFound)
- Rename: success + content preserved, nonexistent source (NotFound),
  existing target (Exists)
- Error mapping: all 8 VfsError variants (adds Unsupported, UnexpectedEof)
- FILETIME: roundtrip, below-offset returns epoch, exactly-offset
- vfs_stat_to_file_info: custom name, dir name from path, alloc_size

smb_fs.rs tests (+40 lines):
- Error mapping: NotFound, AlreadyExists, AccessDenied, IsADirectory,
  NotADirectory, DiskFull, SharingViolation, ConnectionLost, TimedOut,
  SessionExpired, InvalidData, Auth, Io, Cancelled
- Filetime: conversion, below-epoch, exact epoch boundary
- Path: leading slash stripping, root, deep paths
- Rejects trailing backslash
2026-06-20 19:57:20 +08:00
Warren
7eb528d35f SMB Server Phase 2: VFS backend build fix + integration test
Some checks failed
Test / build (push) Has been cancelled
Test / test (push) Has been cancelled
- Add VfsFile: Send supertrait for Mutex compatibility
- Fix SmbServerCommand: struct → Subcommand enum with Start variant
- Fix tracing_subscriber::init() → try_init() to avoid panic when
  logger already initialized
- Fix CLI subcommand name: smb-server → smb-start (flatten naming)
- Add #[command(name = "smb-start")] for CLI disambiguation
- Fix unused variable warnings (smb_fs.rs, smb_server_backend.rs)
- Remove unused VfsFile imports (webdav.rs, scp_handler.rs)
- Integration test: Docker smbclient verified (list, upload, read)
2026-06-20 19:42:29 +08:00
Warren
eb80c07c85 Implement WebDAV VFS integration: dav-server 0.11 compatible
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
- Add webdav.rs module: VfsDavFs, VfsDavFile, VfsDavMetaData
- Implement DavFileSystem + Clone for GuardedFileSystem blanket impl
- Add clone_boxed to VfsBackend trait (required for Sync)
- Update CLI webdav.rs to use VFS instead of SQLite
- Add bytes dependency
- All 155 tests pass
2026-06-19 08:19:16 +08:00
Warren
d94cb2df4c Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs
- Add missing KexProposal import in kex_complete.rs
- Auto-fix clippy warnings across all crates
- All 153 tests pass
2026-06-19 05:21:38 +08:00
Warren
960ee87ce9 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)
2026-06-18 23:44:52 +08:00
Warren
f90e4f496c VFS/DataProvider/Config refactoring + SSH public key authentication
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled
Phase 1-6 of refactoring plan:
- VFS abstraction (VfsBackend trait + LocalFs + OpenFlags builder)
- DataProvider trait (SqliteProvider + PgProvider, SFTPGo-compatible)
- Config refactoring (AppConfig unified sections, env overrides)
- SSH handlers (sftp/scp/rsync) migrated to VFS + DataProvider
- SSH public key authentication (Ed25519 signature verification)
- SSH stderr → CHANNEL_EXTENDED_DATA support
- Web auth uses DataProvider instead of direct SQL
- User home directory from provider (per-user isolation)
- PostgreSQL auth provider for SFTPGo compatibility
2026-06-18 23:35:18 +08:00