refactor: change shared to use interfaces to avoid an import cycle

This commit is contained in:
Derrick Hammer 2023-05-23 20:10:17 -04:00
parent 39936b3b14
commit e8c232dfdd
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 23 additions and 14 deletions

View File

@ -1,36 +1,45 @@
package shared package shared
import ( import (
"git.lumeweb.com/LumeWeb/portal/tusstore"
"github.com/golang-queue/queue"
tusd "github.com/tus/tusd/pkg/handler" tusd "github.com/tus/tusd/pkg/handler"
_ "go.uber.org/zap" _ "go.uber.org/zap"
) )
var tusQueue *queue.Queue type TusFunc func(upload *tusd.Upload) error
var tusStore *tusstore.DbFileStore
var tusComposer *tusd.StoreComposer
func SetTusQueue(q *queue.Queue) { var tusQueue *interface{}
tusQueue = q var tusStore *interface{}
var tusComposer *interface{}
var tusWorker TusFunc
func SetTusQueue(q interface{}) {
tusQueue = &q
} }
func GetTusQueue() *queue.Queue { func GetTusQueue() *interface{} {
return tusQueue return tusQueue
} }
func SetTusStore(s *tusstore.DbFileStore) { func SetTusStore(s interface{}) {
tusStore = s tusStore = &s
} }
func GetTusStore() *tusstore.DbFileStore { func GetTusStore() *interface{} {
return tusStore return tusStore
} }
func SetTusComposer(c *tusd.StoreComposer) { func SetTusComposer(c interface{}) {
tusComposer = c tusComposer = &c
} }
func GetTusComposer() *tusd.StoreComposer { func GetTusComposer() *interface{} {
return tusComposer return tusComposer
} }
func SetTusWorker(w TusFunc) {
tusWorker = w
}
func GetTusWorker() TusFunc {
return tusWorker
}