mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Feat: archive & download routers for test
This commit is contained in:
@@ -1 +1,16 @@
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
|
||||
/* ==============
|
||||
压缩/解压缩
|
||||
==============
|
||||
*/
|
||||
|
||||
// Compress 创建给定目录和文件的压缩文件
|
||||
func (fs *FileSystem) Compress(ctx context.Context, dirs, files []uint) (io.ReadSeeker, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -56,16 +56,16 @@ const (
|
||||
CodeObjectExist = 40004
|
||||
// CodeSignExpired 签名过期
|
||||
CodeSignExpired = 40005
|
||||
// CodePolicyNotAllowed 当前存储策略不允许
|
||||
CodePolicyNotAllowed = 40006
|
||||
// CodeGroupNotAllowed 用户组无法进行此操作
|
||||
CodeGroupNotAllowed = 40007
|
||||
// CodeDBError 数据库操作失败
|
||||
CodeDBError = 50001
|
||||
// CodeEncryptError 加密失败
|
||||
CodeEncryptError = 50002
|
||||
// CodePolicyNotAllowed 当前存储策略不允许
|
||||
CodePolicyNotAllowed = 50003
|
||||
// CodeIOFailed IO操作失败
|
||||
CodeIOFailed = 50004
|
||||
// CodeGroupNotAllowed 当前用户组不允许
|
||||
CodeGroupNotAllowed = 50005
|
||||
//CodeParamErr 各种奇奇怪怪的参数错误
|
||||
CodeParamErr = 40001
|
||||
// CodeNotSet 未定错误,后续尝试从error中获取
|
||||
|
||||
21
pkg/task/pool.go
Normal file
21
pkg/task/pool.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package task
|
||||
|
||||
type Pool struct {
|
||||
// 容量
|
||||
capacity int
|
||||
// 终止信号
|
||||
terminateSignal chan error
|
||||
// 全部任务完成的信号
|
||||
finishSignal chan bool
|
||||
}
|
||||
|
||||
type Worker interface {
|
||||
Do() error
|
||||
}
|
||||
|
||||
func (pool *Pool) Submit(worker Worker) {
|
||||
err := worker.Do()
|
||||
if err != nil {
|
||||
close(pool.terminateSignal)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user