refactor(vfs): 重构VFS模块,拆分数据访问逻辑与路径解析逻辑

将原先的 `vfs.go` 文件中的功能进行拆分,创建了独立的 DAO 层文件 `vfs_dao.go`
和路径处理文件 `vfs_path.go`,以提升代码结构清晰度和可维护性。

- 将数据库操作相关方法迁移至 `VfsDAO` 结构体中
- 新增 `vfs_dao.go` 文件用于管理底层数据访问对象
- 新增 `vfs_path.go` 文件专门处理路径解析逻辑
- 移除了原 `vfs.go` 中的数据库初始化、用户及节点操作等冗余代码
This commit is contained in:
zzy
2025-09-29 00:42:45 +08:00
parent 429a863b76
commit 35e79e54f1
13 changed files with 1106 additions and 1005 deletions

View File

@ -0,0 +1,50 @@
package vfs_service
type VFSErrorType int
const (
ErrorTypeNoError = iota
// 通用错误类型
ErrorTypeNotFound
ErrorTypeAlreadyExists
ErrorTypeForbidden
ErrorTypeInternal
ErrorTypeBadRequest
ErrorTypeUnauthorized
ErrorTypeConflict
ErrorTypeNotImplemented
ErrorTypeInvalidArgument
// 用户相关错误
ErrorTypeUserNotFound
ErrorTypeUserAlreadyExists
ErrorTypeUserCreationFailed
ErrorTypeUserDeletionFailed
// 节点相关错误
ErrorTypeNodeNotFound
ErrorTypeNodeAlreadyExists
ErrorTypeNodeCreationFailed
ErrorTypeNodeDeletionFailed
ErrorTypeNodeUpdateFailed
ErrorTypeNodeMoveFailed
ErrorTypeNodeAccessDenied
// 权限相关错误
ErrorTypePermissionDenied
ErrorTypeInvalidToken
// 服务代理相关错误
ErrorTypeServiceProxyNotFound
ErrorTypeServiceProxyFailed
// 路径相关错误
ErrorTypeInvalidPath
ErrorTypePathNotFound
)
type VFSError struct {
Type VFSErrorType
Error error
}