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
This commit is contained in:
Warren
2026-06-19 08:19:16 +08:00
parent df4f3ea4bd
commit eb80c07c85
8 changed files with 357 additions and 24 deletions

View File

@@ -61,6 +61,10 @@ impl VfsFile for LocalFile {
}
impl VfsBackend for LocalFs {
fn clone_boxed(&self) -> Box<dyn VfsBackend> {
Box::new(Self {})
}
fn read_dir(&self, path: &Path) -> Result<Vec<VfsDirEntry>, VfsError> {
let dir = fs::read_dir(path).map_err(|e| util::map_io_error(path, e))?;

View File

@@ -115,7 +115,10 @@ pub trait VfsFile {
}
/// VFS 后端 trait所有文件系统操作
pub trait VfsBackend: Send {
pub trait VfsBackend: Send + Sync {
/// Clone boxed
fn clone_boxed(&self) -> Box<dyn VfsBackend>;
/// 读取目录内容
fn read_dir(&self, path: &Path) -> Result<Vec<VfsDirEntry>, VfsError>;

View File

@@ -193,6 +193,13 @@ impl S3Vfs {
}
impl VfsBackend for S3Vfs {
fn clone_boxed(&self) -> Box<dyn VfsBackend> {
Box::new(Self {
bucket: self.bucket.clone(),
credentials: self.credentials.clone(),
})
}
fn read_dir(&self, path: &Path) -> Result<Vec<VfsDirEntry>, VfsError> {
let prefix = Self::dir_key(path);
let list = self.list_objects(&prefix)?;