2023-05-16 22:46:08 +00:00
|
|
|
package shared
|
|
|
|
|
|
|
|
import (
|
|
|
|
tusd "github.com/tus/tusd/pkg/handler"
|
2023-05-17 17:34:44 +00:00
|
|
|
_ "go.uber.org/zap"
|
2023-05-16 22:46:08 +00:00
|
|
|
)
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
type TusFunc func(upload *tusd.Upload) error
|
2023-05-16 22:46:08 +00:00
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
var tusQueue *interface{}
|
|
|
|
var tusStore *interface{}
|
|
|
|
var tusComposer *interface{}
|
|
|
|
var tusWorker TusFunc
|
|
|
|
|
2023-06-29 09:48:56 +00:00
|
|
|
type tusRequestContextKey int
|
|
|
|
|
|
|
|
const (
|
|
|
|
TusRequestContextKey tusRequestContextKey = iota
|
|
|
|
)
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func SetTusQueue(q interface{}) {
|
|
|
|
tusQueue = &q
|
2023-05-16 22:46:08 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func GetTusQueue() *interface{} {
|
2023-05-16 22:46:08 +00:00
|
|
|
return tusQueue
|
|
|
|
}
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func SetTusStore(s interface{}) {
|
|
|
|
tusStore = &s
|
2023-05-16 22:46:08 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func GetTusStore() *interface{} {
|
2023-05-16 22:46:08 +00:00
|
|
|
return tusStore
|
|
|
|
}
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func SetTusComposer(c interface{}) {
|
|
|
|
tusComposer = &c
|
2023-05-16 22:46:08 +00:00
|
|
|
}
|
|
|
|
|
2023-05-24 00:10:17 +00:00
|
|
|
func GetTusComposer() *interface{} {
|
2023-05-16 22:46:08 +00:00
|
|
|
return tusComposer
|
|
|
|
}
|
2023-05-24 00:10:17 +00:00
|
|
|
|
|
|
|
func SetTusWorker(w TusFunc) {
|
|
|
|
tusWorker = w
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetTusWorker() TusFunc {
|
|
|
|
return tusWorker
|
|
|
|
}
|