Implement WebDAV VFS integration: dav-server 0.11 compatible
- 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:
@@ -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))?;
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user