feat(cron): add cron scheduler

This commit is contained in:
hexxa 2022-05-24 19:53:36 +08:00 committed by Hexxa
parent 0dfa09033e
commit 0962ddb57c
4 changed files with 32 additions and 12 deletions

View file

@ -4,6 +4,7 @@ import (
"github.com/ihexxa/gocfg"
"go.uber.org/zap"
"github.com/ihexxa/quickshare/src/cron"
"github.com/ihexxa/quickshare/src/cryptoutil"
"github.com/ihexxa/quickshare/src/db/boltstore"
"github.com/ihexxa/quickshare/src/db/fileinfostore"
@ -36,6 +37,7 @@ type Deps struct {
limiter iolimiter.ILimiter
workers worker.IWorkerPool
boltStore *boltstore.BoltStore
cron cron.ICron
}
func NewDeps(cfg gocfg.ICfg) *Deps {
@ -129,3 +131,11 @@ func (deps *Deps) BoltStore() *boltstore.BoltStore {
func (deps *Deps) SetBoltStore(boltStore *boltstore.BoltStore) {
deps.boltStore = boltStore
}
func (deps *Deps) Cron() cron.ICron {
return deps.cron
}
func (deps *Deps) SetCron(cronImp cron.ICron) {
deps.cron = cronImp
}