Feat: archive & download routers for test

This commit is contained in:
HFO4
2019-12-12 10:04:24 +08:00
parent ba34a092d1
commit e8aa0435c5
5 changed files with 64 additions and 4 deletions

View File

@@ -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
}

View File

@@ -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
View 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)
}
}