2025-08-14 19:56:43 +08:00
|
|
|
package file
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// UserFileServer 文件服务接口 #################################################################
|
|
|
|
type UserFileServer interface {
|
2025-08-14 21:44:34 +08:00
|
|
|
// CopyFile 复制文件 =======================================================================
|
|
|
|
CopyFile(ctx context.Context, sources []string, targets []string) ([]*BackFileAction, error)
|
|
|
|
// MoveFile 移动文件 =======================================================================
|
|
|
|
MoveFile(ctx context.Context, sources []string, targets []string) ([]*BackFileAction, error)
|
|
|
|
// NameFile 移动文件 =======================================================================
|
|
|
|
NameFile(ctx context.Context, sources []string, targets []string) ([]*BackFileAction, error)
|
2025-08-14 19:56:43 +08:00
|
|
|
// ListFile 列举文件 =======================================================================
|
|
|
|
ListFile(ctx context.Context, path []string, opt *ListFileOption) ([]*UserFileObject, error)
|
|
|
|
// FindFile 搜索文件 =======================================================================
|
|
|
|
FindFile(ctx context.Context, path []string, opt *FindFileOption) ([]*UserFileObject, error)
|
|
|
|
// Download 获取文件 =======================================================================
|
2025-08-14 21:59:44 +08:00
|
|
|
Download(ctx context.Context, path []string, opt *DownloadOption) ([]*LinkFileObject, error)
|
2025-08-14 19:56:43 +08:00
|
|
|
// Uploader 上传文件 =======================================================================
|
2025-08-14 21:59:44 +08:00
|
|
|
Uploader(ctx context.Context, path []string, opt *UploaderOption) ([]*BackFileAction, error)
|
2025-08-14 19:56:43 +08:00
|
|
|
// KillFile 删除文件 =======================================================================
|
|
|
|
KillFile(ctx context.Context, path []string, opt *KillFileOption) ([]*BackFileAction, error)
|
|
|
|
// MakeFile 搜索文件 =======================================================================
|
|
|
|
MakeFile(ctx context.Context, path []string, opt *MakeFileOption) ([]*BackFileAction, error)
|
|
|
|
// MakePath 搜索文件 =======================================================================
|
|
|
|
MakePath(ctx context.Context, path []string, opt *MakeFileOption) ([]*BackFileAction, error)
|
|
|
|
// PermFile 设置权限 =======================================================================
|
|
|
|
PermFile(ctx context.Context, path []string, opt *PermissionFile) ([]*BackFileAction, error)
|
2025-08-14 21:59:44 +08:00
|
|
|
//// NewShare 创建分享 =======================================================================
|
|
|
|
//NewShare(ctx context.Context, path []string, opt *NewShareAction) ([]*BackFileAction, error)
|
|
|
|
//// GetShare 获取分享 =======================================================================
|
|
|
|
//GetShare(ctx context.Context, path []string, opt *NewShareAction) ([]*UserFileObject, error)
|
|
|
|
//// DelShare 删除分享 =======================================================================
|
|
|
|
//DelShare(ctx context.Context, path []string, opt *NewShareAction) ([]*BackFileAction, error)
|
2025-08-14 19:56:43 +08:00
|
|
|
}
|
2025-08-14 21:30:18 +08:00
|
|
|
|
2025-08-14 21:44:34 +08:00
|
|
|
type UserFileUpload interface {
|
|
|
|
fullPost(ctx context.Context, path []string)
|
|
|
|
pfCreate(ctx context.Context, path []string)
|
|
|
|
pfUpload(ctx context.Context, path []string)
|
|
|
|
pfUpdate(ctx context.Context, path []string)
|
|
|
|
}
|
|
|
|
|
2025-08-14 21:30:18 +08:00
|
|
|
func ListFile(ctx context.Context, path []string, opt *ListFileOption) ([]*UserFileObject, error) {
|
2025-08-14 21:59:44 +08:00
|
|
|
return ListDeal([]*HostFileObject{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func FindFile(ctx context.Context, path []string, opt *ListFileOption) ([]*UserFileObject, error) {
|
|
|
|
return ListDeal([]*HostFileObject{})
|
|
|
|
}
|
|
|
|
|
|
|
|
func ListDeal(originList []*HostFileObject) ([]*UserFileObject, error) {
|
2025-08-14 21:30:18 +08:00
|
|
|
serverList := make([]*UserFileObject, 0)
|
|
|
|
for _, fileItem := range originList {
|
|
|
|
serverList = append(serverList, &UserFileObject{
|
|
|
|
HostFileObject: *fileItem,
|
2025-08-14 21:59:44 +08:00
|
|
|
// ... 用户层逻辑
|
2025-08-14 21:30:18 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
return serverList, nil
|
|
|
|
}
|
2025-08-14 21:59:44 +08:00
|
|
|
|
|
|
|
func Download(ctx context.Context, path []string, opt *ListFileOption) ([]*LinkFileObject, error) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func Uploader(ctx context.Context, path []string, opt *ListFileOption) ([]*BackFileAction, error) {
|
|
|
|
|
|
|
|
}
|