Documentation
¶
Overview ¶
Package fs provides filesystem operations for OpenList
Index ¶
- Variables
- func ArchiveDecompress(ctx context.Context, srcObjPath, dstDirPath string, ...) (task.TaskExtensionInfo, error)
- func ArchiveDriverExtract(ctx context.Context, path string, args model.ArchiveInnerArgs) (*model.Link, model.Obj, error)
- func ArchiveInternalExtract(ctx context.Context, path string, args model.ArchiveInnerArgs) (io.ReadCloser, int64, error)
- func ArchiveList(ctx context.Context, path string, args model.ArchiveListArgs) ([]model.Obj, error)
- func ArchiveMeta(ctx context.Context, path string, args model.ArchiveMetaArgs) (*model.ArchiveMetaProvider, error)
- func Copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool) (task.TaskExtensionInfo, error)
- func Get(ctx context.Context, path string, args *GetArgs) (model.Obj, error)
- func GetStorage(path string, args *GetStoragesArgs) (driver.Driver, error)
- func Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error)
- func List(ctx context.Context, path string, args *ListArgs) ([]model.Obj, error)
- func MakeDir(ctx context.Context, path string, lazyCache ...bool) error
- func Move(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) error
- func MoveWithTask(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) (task.TaskExtensionInfo, error)
- func MoveWithTaskAndValidation(ctx context.Context, srcPath, dstDirPath string, validateExistence bool, ...) (task.TaskExtensionInfo, error)
- func Other(ctx context.Context, args model.FsOtherArgs) (any, error)
- func PutAsTask(ctx context.Context, dstDirPath string, file model.FileStreamer) (task.TaskExtensionInfo, error)
- func PutDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer, ...) error
- func PutURL(ctx context.Context, path, dstName, urlStr string) error
- func Remove(ctx context.Context, path string) error
- func Rename(ctx context.Context, srcPath, dstName string, lazyCache ...bool) error
- func WalkFS(ctx context.Context, depth int, name string, info model.Obj, ...) error
- type ArchiveContentUploadTask
- func (t *ArchiveContentUploadTask) Cancel()
- func (t *ArchiveContentUploadTask) GetName() string
- func (t *ArchiveContentUploadTask) GetStatus() string
- func (t *ArchiveContentUploadTask) Run() error
- func (t *ArchiveContentUploadTask) RunWithNextTaskCallback(nextTaskCallback func(nextTask *ArchiveContentUploadTask) error) error
- type ArchiveDownloadTask
- type CopyTask
- type GetArgs
- type GetStoragesArgs
- type ListArgs
- type MoveProgress
- type MoveTask
- type UploadTask
Constants ¶
This section is empty.
Variables ¶
var ArchiveContentUploadTaskManager = &archiveContentUploadTaskManagerType{ Manager: nil, }
ArchiveContentUploadTaskManager manages archive content upload tasks
var ArchiveDownloadTaskManager *tache.Manager[*ArchiveDownloadTask]
ArchiveDownloadTaskManager manages asynchronous archive download tasks
var CopyTaskManager *tache.Manager[*CopyTask]
CopyTaskManager manages asynchronous copy tasks
var MoveTaskManager *tache.Manager[*MoveTask]
var UploadTaskManager *tache.Manager[*UploadTask]
Functions ¶
func ArchiveDecompress ¶
func ArchiveDecompress(ctx context.Context, srcObjPath, dstDirPath string, args model.ArchiveDecompressArgs, lazyCache ...bool) (task.TaskExtensionInfo, error)
ArchiveDecompress 解压归档
func ArchiveDriverExtract ¶
func ArchiveDriverExtract(ctx context.Context, path string, args model.ArchiveInnerArgs) (*model.Link, model.Obj, error)
ArchiveDriverExtract 提取归档内容
func ArchiveInternalExtract ¶
func ArchiveInternalExtract(ctx context.Context, path string, args model.ArchiveInnerArgs) (io.ReadCloser, int64, error)
ArchiveInternalExtract 内部提取归档内容
func ArchiveList ¶
ArchiveList 列出归档内容
func ArchiveMeta ¶
func ArchiveMeta(ctx context.Context, path string, args model.ArchiveMetaArgs) (*model.ArchiveMetaProvider, error)
ArchiveMeta 获取归档元数据
func Copy ¶
func Copy(ctx context.Context, srcObjPath, dstDirPath string, lazyCache ...bool) (task.TaskExtensionInfo, error)
Copy 复制文件或目录
func GetStorage ¶
func GetStorage(path string, args *GetStoragesArgs) (driver.Driver, error)
GetStorage 获取存储驱动
func MoveWithTask ¶
func MoveWithTask(ctx context.Context, srcPath, dstDirPath string, lazyCache ...bool) (task.TaskExtensionInfo, error)
MoveWithTask 创建移动任务
func MoveWithTaskAndValidation ¶
func MoveWithTaskAndValidation(ctx context.Context, srcPath, dstDirPath string, validateExistence bool, lazyCache ...bool) (task.TaskExtensionInfo, error)
MoveWithTaskAndValidation 创建带验证的移动任务
func PutAsTask ¶
func PutAsTask(ctx context.Context, dstDirPath string, file model.FileStreamer) (task.TaskExtensionInfo, error)
PutAsTask 创建上传任务
func PutDirectly ¶
func PutDirectly(ctx context.Context, dstDirPath string, file model.FileStreamer, lazyCache ...bool) error
PutDirectly 直接上传文件
func WalkFS ¶
func WalkFS(ctx context.Context, depth int, name string, info model.Obj, walkFn func(reqPath string, info model.Obj) error) error
WalkFS traverses filesystem fs starting at name up to depth levels.
WalkFS will stop when current depth > `depth`. For each visited node, WalkFS calls walkFn. If a visited file system node is a directory and walkFn returns path.SkipDir, walkFS will skip traversal of this node.
Types ¶
type ArchiveContentUploadTask ¶
type ArchiveContentUploadTask struct {
task.TaskExtension
ObjName string // Object name
InPlace bool // Whether to upload in place or in a new directory
FilePath string // Path to the file or directory to upload
DstDirPath string // Destination directory path
DstStorageMp string // Destination storage mount path
// contains filtered or unexported fields
}
ArchiveContentUploadTask represents a task for uploading decompressed archive content
func (*ArchiveContentUploadTask) Cancel ¶
func (t *ArchiveContentUploadTask) Cancel()
Cancel cancels the task and cleans up resources if allowed
func (*ArchiveContentUploadTask) GetName ¶
func (t *ArchiveContentUploadTask) GetName() string
GetName returns a human-readable name for the archive content upload task
func (*ArchiveContentUploadTask) GetStatus ¶
func (t *ArchiveContentUploadTask) GetStatus() string
GetStatus returns the current status of the archive content upload task
func (*ArchiveContentUploadTask) Run ¶
func (t *ArchiveContentUploadTask) Run() error
Run executes the archive content upload task
func (*ArchiveContentUploadTask) RunWithNextTaskCallback ¶
func (t *ArchiveContentUploadTask) RunWithNextTaskCallback(nextTaskCallback func(nextTask *ArchiveContentUploadTask) error) error
RunWithNextTaskCallback executes the upload task with a custom callback for handling subtasks
type ArchiveDownloadTask ¶
type ArchiveDownloadTask struct {
task.TaskExtension
model.ArchiveDecompressArgs
SrcObjPath string // Source object path
DstDirPath string // Destination directory path
SrcStorageMp string // Source storage mount path
DstStorageMp string // Destination storage mount path
// contains filtered or unexported fields
}
ArchiveDownloadTask represents a task for downloading and decompressing archive files
func (*ArchiveDownloadTask) GetName ¶
func (t *ArchiveDownloadTask) GetName() string
GetName returns a human-readable name for the archive download task
func (*ArchiveDownloadTask) GetStatus ¶
func (t *ArchiveDownloadTask) GetStatus() string
GetStatus returns the current status of the archive download task
func (*ArchiveDownloadTask) Run ¶
func (t *ArchiveDownloadTask) Run() error
Run executes the archive download task
func (*ArchiveDownloadTask) RunWithoutPushUploadTask ¶
func (t *ArchiveDownloadTask) RunWithoutPushUploadTask() (*ArchiveContentUploadTask, error)
RunWithoutPushUploadTask performs the decompression without adding the resulting upload task to the manager Returns the upload task for the extracted content
type CopyTask ¶
type CopyTask struct {
task.TaskExtension
Status string `json:"-"` // Current status (not persisted)
SrcObjPath string `json:"src_path"` // Source object path
DstDirPath string `json:"dst_path"` // Destination directory path
SrcStorageMp string `json:"src_storage_mp"` // Source storage mount path
DstStorageMp string `json:"dst_storage_mp"` // Destination storage mount path
// contains filtered or unexported fields
}
CopyTask represents an asynchronous file/directory copy operation
type GetStoragesArgs ¶
type GetStoragesArgs struct {
}
type MoveProgress ¶
type MoveProgress struct {
TaskID string `json:"task_id"`
Phase string `json:"phase"`
TotalFiles int `json:"total_files"`
CompletedFiles int `json:"completed_files"`
CurrentFile string `json:"current_file"`
Status string `json:"status"`
Progress int `json:"progress"`
}
func GetMoveProgress ¶
func GetMoveProgress(taskID string) (*MoveProgress, bool)
GetMoveProgress returns the progress of a move task by task ID
func GetMoveTaskProgress ¶
func GetMoveTaskProgress(task *MoveTask) *MoveProgress
GetMoveTaskProgress returns the progress of a specific move task
type MoveTask ¶
type MoveTask struct {
task.TaskExtension
Status string `json:"-"`
SrcObjPath string `json:"src_path"`
DstDirPath string `json:"dst_path"`
SrcStorageMp string `json:"src_storage_mp"`
DstStorageMp string `json:"dst_storage_mp"`
IsRootTask bool `json:"is_root_task"`
RootTaskID string `json:"root_task_id"`
TotalFiles int `json:"total_files"`
CompletedFiles int `json:"completed_files"`
Phase string `json:"phase"` // "copying", "verifying", "deleting", "completed"
ValidateExistence bool `json:"validate_existence"`
// contains filtered or unexported fields
}
func (*MoveTask) GetMoveProgress ¶
func (t *MoveTask) GetMoveProgress() *MoveProgress
func (*MoveTask) GetProgress ¶
type UploadTask ¶
type UploadTask struct {
task.TaskExtension
// contains filtered or unexported fields
}
func (*UploadTask) GetName ¶
func (t *UploadTask) GetName() string
func (*UploadTask) GetStatus ¶
func (t *UploadTask) GetStatus() string
func (*UploadTask) Run ¶
func (t *UploadTask) Run() error