fix(worker): refactor and fix issues of worker

This commit is contained in:
hexxa 2021-09-12 12:45:03 +08:00 committed by Hexxa
parent 8518072c7e
commit 4a5c68df17
13 changed files with 194 additions and 86 deletions

View file

@ -11,6 +11,7 @@ import (
"github.com/ihexxa/quickshare/src/iolimiter"
"github.com/ihexxa/quickshare/src/kvstore"
"github.com/ihexxa/quickshare/src/userstore"
"github.com/ihexxa/quickshare/src/worker"
)
type IUploader interface {
@ -27,10 +28,10 @@ type Deps struct {
kv kvstore.IKVStore
users userstore.IUserStore
fileInfos fileinfostore.IFileInfoStore
uploader IUploader
id idgen.IIDGen
logger *zap.SugaredLogger
limiter iolimiter.ILimiter
workers worker.IWorkerPool
}
func NewDeps(cfg gocfg.ICfg) *Deps {
@ -100,3 +101,11 @@ func (deps *Deps) Limiter() iolimiter.ILimiter {
func (deps *Deps) SetLimiter(limiter iolimiter.ILimiter) {
deps.limiter = limiter
}
func (deps *Deps) Workers() worker.IWorkerPool {
return deps.workers
}
func (deps *Deps) SetWorkers(workers worker.IWorkerPool) {
deps.workers = workers
}