feat(archive): archive manage (#7817)

* feat(archive): archive management

* fix(ftp-server): remove duplicate ReadAtSeeker realization

* fix(archive): bad seeking of SeekableStream

* fix(archive): split internal and driver extraction api

* feat(archive): patch

* fix(shutdown): clear decompress upload tasks

* chore

* feat(archive): support .iso format

* chore
This commit is contained in:
KirCute_ECT
2025-01-18 23:28:12 +08:00
committed by GitHub
parent ab22cf8233
commit bb40e2e2cd
36 changed files with 2854 additions and 127 deletions

View File

@ -123,7 +123,43 @@ type PutURLResult interface {
PutURL(ctx context.Context, dstDir model.Obj, name, url string) (model.Obj, error)
}
type UpdateProgress func(percentage float64)
type ArchiveReader interface {
// GetArchiveMeta get the meta-info of an archive
// return errs.WrongArchivePassword if the meta-info is also encrypted but provided password is wrong or empty
// return errs.NotImplement to use internal archive tools to get the meta-info, such as the following cases:
// 1. the driver do not support the format of the archive but there may be an internal tool do
// 2. handling archives is a VIP feature, but the driver does not have VIP access
GetArchiveMeta(ctx context.Context, obj model.Obj, args model.ArchiveArgs) (model.ArchiveMeta, error)
// ListArchive list the children of model.ArchiveArgs.InnerPath in the archive
// return errs.NotImplement to use internal archive tools to list the children
// return errs.NotSupport if the folder structure should be acquired from model.ArchiveMeta.GetTree
ListArchive(ctx context.Context, obj model.Obj, args model.ArchiveInnerArgs) ([]model.Obj, error)
// Extract get url/filepath/reader of a file in the archive
// return errs.NotImplement to use internal archive tools to extract
Extract(ctx context.Context, obj model.Obj, args model.ArchiveInnerArgs) (*model.Link, error)
}
type ArchiveGetter interface {
// ArchiveGet get file by inner path
// return errs.NotImplement to use internal archive tools to get the children
// return errs.NotSupport if the folder structure should be acquired from model.ArchiveMeta.GetTree
ArchiveGet(ctx context.Context, obj model.Obj, args model.ArchiveInnerArgs) (model.Obj, error)
}
type ArchiveDecompress interface {
ArchiveDecompress(ctx context.Context, srcObj, dstDir model.Obj, args model.ArchiveDecompressArgs) error
}
type ArchiveDecompressResult interface {
// ArchiveDecompress decompress an archive
// when args.PutIntoNewDir, the new sub-folder should be named the same to the archive but without the extension
// return each decompressed obj from the root path of the archive when args.PutIntoNewDir is false
// return only the newly created folder when args.PutIntoNewDir is true
// return errs.NotImplement to use internal archive tools to decompress
ArchiveDecompress(ctx context.Context, srcObj, dstDir model.Obj, args model.ArchiveDecompressArgs) ([]model.Obj, error)
}
type UpdateProgress model.UpdateProgress
type Progress struct {
Total int64