fix(files): add boltdb store and refactor files handlers

This commit is contained in:
hexxa 2022-03-05 00:16:04 +08:00 committed by Hexxa
parent 044cdea1d4
commit 17b4544487
19 changed files with 751 additions and 402 deletions

View file

@ -5,6 +5,7 @@ import (
"go.uber.org/zap"
"github.com/ihexxa/quickshare/src/cryptoutil"
"github.com/ihexxa/quickshare/src/db/boltstore"
"github.com/ihexxa/quickshare/src/db/fileinfostore"
"github.com/ihexxa/quickshare/src/db/sitestore"
"github.com/ihexxa/quickshare/src/db/userstore"
@ -34,6 +35,7 @@ type Deps struct {
logger *zap.SugaredLogger
limiter iolimiter.ILimiter
workers worker.IWorkerPool
boltStore *boltstore.BoltStore
}
func NewDeps(cfg gocfg.ICfg) *Deps {
@ -119,3 +121,11 @@ func (deps *Deps) Workers() worker.IWorkerPool {
func (deps *Deps) SetWorkers(workers worker.IWorkerPool) {
deps.workers = workers
}
func (deps *Deps) BoltStore() *boltstore.BoltStore {
return deps.boltStore
}
func (deps *Deps) SetBoltStore(boltStore *boltstore.BoltStore) {
deps.boltStore = boltStore
}