refactor: return s3 client instance with BuildUploadBufferTus
This commit is contained in:
parent
bf36562fca
commit
da298cc56f
|
@ -13,7 +13,7 @@ type StorageService interface {
|
||||||
Portal() Portal
|
Portal() Portal
|
||||||
PutFileSmall(file io.ReadSeeker, bucket string, generateProof bool) ([]byte, error)
|
PutFileSmall(file io.ReadSeeker, bucket string, generateProof bool) ([]byte, error)
|
||||||
PutFile(file io.Reader, bucket string, hash []byte) error
|
PutFile(file io.Reader, bucket string, hash []byte) error
|
||||||
BuildUploadBufferTus(basePath string, preUploadCb TusPreUploadCreateCallback, preFinishCb TusPreFinishResponseCallback) (*tusd.Handler, tusd.DataStore, error)
|
BuildUploadBufferTus(basePath string, preUploadCb TusPreUploadCreateCallback, preFinishCb TusPreFinishResponseCallback) (*tusd.Handler, tusd.DataStore, *s3.Client, error)
|
||||||
FileExists(hash []byte) (bool, models.Upload)
|
FileExists(hash []byte) (bool, models.Upload)
|
||||||
GetHashSmall(file io.ReadSeeker) ([]byte, error)
|
GetHashSmall(file io.ReadSeeker) ([]byte, error)
|
||||||
GetHash(file io.Reader) ([]byte, error)
|
GetHash(file io.Reader) ([]byte, error)
|
||||||
|
|
|
@ -118,7 +118,7 @@ func (s StorageServiceImpl) PutFile(file io.Reader, bucket string, hash []byte)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageServiceImpl) BuildUploadBufferTus(basePath string, preUploadCb interfaces.TusPreUploadCreateCallback, preFinishCb interfaces.TusPreFinishResponseCallback) (*tusd.Handler, tusd.DataStore, error) {
|
func (s *StorageServiceImpl) BuildUploadBufferTus(basePath string, preUploadCb interfaces.TusPreUploadCreateCallback, preFinishCb interfaces.TusPreFinishResponseCallback) (*tusd.Handler, tusd.DataStore, *s3.Client, error) {
|
||||||
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
customResolver := aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
|
||||||
if service == s3.ServiceID {
|
if service == s3.ServiceID {
|
||||||
return aws.Endpoint{
|
return aws.Endpoint{
|
||||||
|
@ -139,7 +139,7 @@ func (s *StorageServiceImpl) BuildUploadBufferTus(basePath string, preUploadCb i
|
||||||
config.WithEndpointResolverWithOptions(customResolver),
|
config.WithEndpointResolverWithOptions(customResolver),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil
|
return nil, nil, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
s3Client := s3.NewFromConfig(cfg)
|
s3Client := s3.NewFromConfig(cfg)
|
||||||
|
@ -162,7 +162,7 @@ func (s *StorageServiceImpl) BuildUploadBufferTus(basePath string, preUploadCb i
|
||||||
PreUploadCreateCallback: preUploadCb,
|
PreUploadCreateCallback: preUploadCb,
|
||||||
})
|
})
|
||||||
|
|
||||||
return handler, store, err
|
return handler, store, s3Client, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageServiceImpl) Init() error {
|
func (s *StorageServiceImpl) Init() error {
|
||||||
|
|
Loading…
Reference in New Issue