refactor: add getStore helper

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

View File

@ -12,7 +12,9 @@ import (
"git.lumeweb.com/LumeWeb/portal/model"
"git.lumeweb.com/LumeWeb/portal/renterd"
"git.lumeweb.com/LumeWeb/portal/shared"
"git.lumeweb.com/LumeWeb/portal/tusstore"
"github.com/go-resty/resty/v2"
_ "github.com/tus/tusd/pkg/handler"
"go.uber.org/zap"
"io"
"strings"
@ -155,7 +157,7 @@ func Download(hash string) (io.Reader, error) {
return nil, err
}
upload, err := shared.GetTusStore().GetUpload(context.Background(), tusData.UploadID)
upload, err := getStore().GetUpload(context.Background(), tusData.UploadID)
if err != nil {
logger.Get().Error("Failed querying tus upload", zap.Error(err))
return nil, err
@ -207,3 +209,8 @@ func getWorkerProofUrl(hash string) string {
func getBusProofUrl(hash string) string {
return objectUrlBuilder(hash, true, true)
}
func getStore() *tusstore.DbFileStore {
ret := shared.GetTusStore()
return (*ret).(*tusstore.DbFileStore)
}