2023-05-16 22:46:08 +00:00
|
|
|
package shared
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/golang-queue/queue"
|
|
|
|
"github.com/tus/tusd/pkg/filestore"
|
|
|
|
tusd "github.com/tus/tusd/pkg/handler"
|
2023-05-17 17:34:44 +00:00
|
|
|
"go.uber.org/zap"
|
|
|
|
_ "go.uber.org/zap"
|
|
|
|
"log"
|
2023-05-16 22:46:08 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var tusQueue *queue.Queue
|
|
|
|
var tusStore *filestore.FileStore
|
|
|
|
var tusComposer *tusd.StoreComposer
|
2023-05-17 17:34:44 +00:00
|
|
|
var logger *zap.Logger
|
2023-05-16 22:46:08 +00:00
|
|
|
|
|
|
|
func SetTusQueue(q *queue.Queue) {
|
|
|
|
tusQueue = q
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetTusQueue() *queue.Queue {
|
|
|
|
return tusQueue
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetTusStore(s *filestore.FileStore) {
|
|
|
|
tusStore = s
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetTusStore() *filestore.FileStore {
|
|
|
|
return tusStore
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetTusComposer(c *tusd.StoreComposer) {
|
|
|
|
tusComposer = c
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetTusComposer() *tusd.StoreComposer {
|
|
|
|
return tusComposer
|
|
|
|
}
|
2023-05-17 17:34:44 +00:00
|
|
|
|
|
|
|
func Init() {
|
|
|
|
newLogger, err := zap.NewProduction()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
logger = newLogger
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetLogger() *zap.Logger {
|
|
|
|
return logger
|
|
|
|
}
|