core: Change GetReader to return io.ReadCloser (#739)

Squashed commit of the following:

commit e8b5b3751a86d86cae10e0bcf89caa481e5c3de6
Author: Marius <marius@transloadit.com>
Date:   Sun Jun 19 12:15:22 2022 +0200

    Fix generated mocks

commit 736e2e7bb6
Merge: 9d7096f 1e69d9b
Author: Stefan Scheidewig <stefan.scheidewig@staffbase.com>
Date:   Sat Jun 18 07:53:29 2022 +0200

    Merge branch 'v2' into readcloser_in_getreader

commit 9d7096fcb3
Author: Stefan Scheidewig <stefan.scheidewig@staffbase.com>
Date:   Tue May 24 14:16:01 2022 +0200

    Return ReadCloser in getReader
This commit is contained in:
Marius 2022-06-19 12:18:02 +02:00
parent 1e69d9ba68
commit 1038298a79
13 changed files with 245 additions and 267 deletions

View File

@ -15,7 +15,6 @@
package azurestore package azurestore
import ( import (
"bytes"
"context" "context"
"encoding/base64" "encoding/base64"
"encoding/binary" "encoding/binary"
@ -59,8 +58,8 @@ type AzBlob interface {
Delete(ctx context.Context) error Delete(ctx context.Context) error
// Upload the blob // Upload the blob
Upload(ctx context.Context, body io.ReadSeeker) error Upload(ctx context.Context, body io.ReadSeeker) error
// Download the contents of the blob // Download returns a readcloser to download the contents of the blob
Download(ctx context.Context) ([]byte, error) Download(ctx context.Context) (io.ReadCloser, error)
// Get the offset of the blob and its indexes // Get the offset of the blob and its indexes
GetOffset(ctx context.Context) (int64, error) GetOffset(ctx context.Context) (int64, error)
// Commit the uploaded blocks to the BlockBlob // Commit the uploaded blocks to the BlockBlob
@ -171,7 +170,7 @@ func (blockBlob *BlockBlob) Upload(ctx context.Context, body io.ReadSeeker) erro
} }
// Download the blockBlob from Azure Blob Storage // Download the blockBlob from Azure Blob Storage
func (blockBlob *BlockBlob) Download(ctx context.Context) (data []byte, err error) { func (blockBlob *BlockBlob) Download(ctx context.Context) (io.ReadCloser, error) {
downloadResponse, err := blockBlob.Blob.Download(ctx, 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{}) downloadResponse, err := blockBlob.Blob.Download(ctx, 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
// If the file does not exist, it will not return an error, but a 404 status and body // If the file does not exist, it will not return an error, but a 404 status and body
@ -186,15 +185,7 @@ func (blockBlob *BlockBlob) Download(ctx context.Context) (data []byte, err erro
return nil, err return nil, err
} }
bodyStream := downloadResponse.Body(azblob.RetryReaderOptions{MaxRetryRequests: 20}) return downloadResponse.Body(azblob.RetryReaderOptions{MaxRetryRequests: 20}), nil
downloadedData := bytes.Buffer{}
_, err = downloadedData.ReadFrom(bodyStream)
if err != nil {
return nil, err
}
return downloadedData.Bytes(), nil
} }
func (blockBlob *BlockBlob) GetOffset(ctx context.Context) (int64, error) { func (blockBlob *BlockBlob) GetOffset(ctx context.Context) (int64, error) {
@ -258,7 +249,7 @@ func (infoBlob *InfoBlob) Upload(ctx context.Context, body io.ReadSeeker) error
} }
// Download the infoBlob from Azure Blob Storage // Download the infoBlob from Azure Blob Storage
func (infoBlob *InfoBlob) Download(ctx context.Context) ([]byte, error) { func (infoBlob *InfoBlob) Download(ctx context.Context) (io.ReadCloser, error) {
downloadResponse, err := infoBlob.Blob.Download(ctx, 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{}) downloadResponse, err := infoBlob.Blob.Download(ctx, 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
// If the file does not exist, it will not return an error, but a 404 status and body // If the file does not exist, it will not return an error, but a 404 status and body
@ -272,15 +263,7 @@ func (infoBlob *InfoBlob) Download(ctx context.Context) ([]byte, error) {
return nil, err return nil, err
} }
bodyStream := downloadResponse.Body(azblob.RetryReaderOptions{MaxRetryRequests: 20}) return downloadResponse.Body(azblob.RetryReaderOptions{MaxRetryRequests: 20}), nil
downloadedData := bytes.Buffer{}
_, err = downloadedData.ReadFrom(bodyStream)
if err != nil {
return nil, err
}
return downloadedData.Bytes(), nil
} }
// infoBlob does not utilise offset, so just return 0, nil // infoBlob does not utilise offset, so just return 0, nil

View File

@ -96,8 +96,9 @@ func (store AzureStore) GetUpload(ctx context.Context, id string) (handler.Uploa
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer data.Close()
if err := json.Unmarshal(data, &info); err != nil { if err := json.NewDecoder(data).Decode(&info); err != nil {
return nil, err return nil, err
} }
@ -173,7 +174,7 @@ func (upload *AzUpload) GetInfo(ctx context.Context) (handler.FileInfo, error) {
return info, err return info, err
} }
if err := json.Unmarshal(data, &info); err != nil { if err := json.NewDecoder(data).Decode(&info); err != nil {
return info, err return info, err
} }
@ -182,12 +183,8 @@ func (upload *AzUpload) GetInfo(ctx context.Context) (handler.FileInfo, error) {
} }
// Get the uploaded file from the Azure storage // Get the uploaded file from the Azure storage
func (upload *AzUpload) GetReader(ctx context.Context) (io.Reader, error) { func (upload *AzUpload) GetReader(ctx context.Context) (io.ReadCloser, error) {
b, err := upload.BlockBlob.Download(ctx) return upload.BlockBlob.Download(ctx)
if err != nil {
return nil, err
}
return bytes.NewReader(b), nil
} }
// Finish the file upload and commit the block list // Finish the file upload and commit the block list

View File

@ -6,36 +6,37 @@ package azurestore_test
import ( import (
context "context" context "context"
gomock "github.com/golang/mock/gomock"
azurestore "github.com/tus/tusd/pkg/azurestore"
io "io" io "io"
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock"
azurestore "github.com/tus/tusd/pkg/azurestore"
) )
// MockAzService is a mock of AzService interface // MockAzService is a mock of AzService interface.
type MockAzService struct { type MockAzService struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockAzServiceMockRecorder recorder *MockAzServiceMockRecorder
} }
// MockAzServiceMockRecorder is the mock recorder for MockAzService // MockAzServiceMockRecorder is the mock recorder for MockAzService.
type MockAzServiceMockRecorder struct { type MockAzServiceMockRecorder struct {
mock *MockAzService mock *MockAzService
} }
// NewMockAzService creates a new mock instance // NewMockAzService creates a new mock instance.
func NewMockAzService(ctrl *gomock.Controller) *MockAzService { func NewMockAzService(ctrl *gomock.Controller) *MockAzService {
mock := &MockAzService{ctrl: ctrl} mock := &MockAzService{ctrl: ctrl}
mock.recorder = &MockAzServiceMockRecorder{mock} mock.recorder = &MockAzServiceMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockAzService) EXPECT() *MockAzServiceMockRecorder { func (m *MockAzService) EXPECT() *MockAzServiceMockRecorder {
return m.recorder return m.recorder
} }
// NewBlob mocks base method // NewBlob mocks base method.
func (m *MockAzService) NewBlob(arg0 context.Context, arg1 string) (azurestore.AzBlob, error) { func (m *MockAzService) NewBlob(arg0 context.Context, arg1 string) (azurestore.AzBlob, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NewBlob", arg0, arg1) ret := m.ctrl.Call(m, "NewBlob", arg0, arg1)
@ -44,36 +45,36 @@ func (m *MockAzService) NewBlob(arg0 context.Context, arg1 string) (azurestore.A
return ret0, ret1 return ret0, ret1
} }
// NewBlob indicates an expected call of NewBlob // NewBlob indicates an expected call of NewBlob.
func (mr *MockAzServiceMockRecorder) NewBlob(arg0, arg1 interface{}) *gomock.Call { func (mr *MockAzServiceMockRecorder) NewBlob(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBlob", reflect.TypeOf((*MockAzService)(nil).NewBlob), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBlob", reflect.TypeOf((*MockAzService)(nil).NewBlob), arg0, arg1)
} }
// MockAzBlob is a mock of AzBlob interface // MockAzBlob is a mock of AzBlob interface.
type MockAzBlob struct { type MockAzBlob struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockAzBlobMockRecorder recorder *MockAzBlobMockRecorder
} }
// MockAzBlobMockRecorder is the mock recorder for MockAzBlob // MockAzBlobMockRecorder is the mock recorder for MockAzBlob.
type MockAzBlobMockRecorder struct { type MockAzBlobMockRecorder struct {
mock *MockAzBlob mock *MockAzBlob
} }
// NewMockAzBlob creates a new mock instance // NewMockAzBlob creates a new mock instance.
func NewMockAzBlob(ctrl *gomock.Controller) *MockAzBlob { func NewMockAzBlob(ctrl *gomock.Controller) *MockAzBlob {
mock := &MockAzBlob{ctrl: ctrl} mock := &MockAzBlob{ctrl: ctrl}
mock.recorder = &MockAzBlobMockRecorder{mock} mock.recorder = &MockAzBlobMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockAzBlob) EXPECT() *MockAzBlobMockRecorder { func (m *MockAzBlob) EXPECT() *MockAzBlobMockRecorder {
return m.recorder return m.recorder
} }
// Commit mocks base method // Commit mocks base method.
func (m *MockAzBlob) Commit(arg0 context.Context) error { func (m *MockAzBlob) Commit(arg0 context.Context) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Commit", arg0) ret := m.ctrl.Call(m, "Commit", arg0)
@ -81,13 +82,13 @@ func (m *MockAzBlob) Commit(arg0 context.Context) error {
return ret0 return ret0
} }
// Commit indicates an expected call of Commit // Commit indicates an expected call of Commit.
func (mr *MockAzBlobMockRecorder) Commit(arg0 interface{}) *gomock.Call { func (mr *MockAzBlobMockRecorder) Commit(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Commit", reflect.TypeOf((*MockAzBlob)(nil).Commit), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Commit", reflect.TypeOf((*MockAzBlob)(nil).Commit), arg0)
} }
// Delete mocks base method // Delete mocks base method.
func (m *MockAzBlob) Delete(arg0 context.Context) error { func (m *MockAzBlob) Delete(arg0 context.Context) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Delete", arg0) ret := m.ctrl.Call(m, "Delete", arg0)
@ -95,28 +96,28 @@ func (m *MockAzBlob) Delete(arg0 context.Context) error {
return ret0 return ret0
} }
// Delete indicates an expected call of Delete // Delete indicates an expected call of Delete.
func (mr *MockAzBlobMockRecorder) Delete(arg0 interface{}) *gomock.Call { func (mr *MockAzBlobMockRecorder) Delete(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockAzBlob)(nil).Delete), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockAzBlob)(nil).Delete), arg0)
} }
// Download mocks base method // Download mocks base method.
func (m *MockAzBlob) Download(arg0 context.Context) ([]byte, error) { func (m *MockAzBlob) Download(arg0 context.Context) (io.ReadCloser, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Download", arg0) ret := m.ctrl.Call(m, "Download", arg0)
ret0, _ := ret[0].([]byte) ret0, _ := ret[0].(io.ReadCloser)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// Download indicates an expected call of Download // Download indicates an expected call of Download.
func (mr *MockAzBlobMockRecorder) Download(arg0 interface{}) *gomock.Call { func (mr *MockAzBlobMockRecorder) Download(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Download", reflect.TypeOf((*MockAzBlob)(nil).Download), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Download", reflect.TypeOf((*MockAzBlob)(nil).Download), arg0)
} }
// GetOffset mocks base method // GetOffset mocks base method.
func (m *MockAzBlob) GetOffset(arg0 context.Context) (int64, error) { func (m *MockAzBlob) GetOffset(arg0 context.Context) (int64, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetOffset", arg0) ret := m.ctrl.Call(m, "GetOffset", arg0)
@ -125,13 +126,13 @@ func (m *MockAzBlob) GetOffset(arg0 context.Context) (int64, error) {
return ret0, ret1 return ret0, ret1
} }
// GetOffset indicates an expected call of GetOffset // GetOffset indicates an expected call of GetOffset.
func (mr *MockAzBlobMockRecorder) GetOffset(arg0 interface{}) *gomock.Call { func (mr *MockAzBlobMockRecorder) GetOffset(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOffset", reflect.TypeOf((*MockAzBlob)(nil).GetOffset), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOffset", reflect.TypeOf((*MockAzBlob)(nil).GetOffset), arg0)
} }
// Upload mocks base method // Upload mocks base method.
func (m *MockAzBlob) Upload(arg0 context.Context, arg1 io.ReadSeeker) error { func (m *MockAzBlob) Upload(arg0 context.Context, arg1 io.ReadSeeker) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Upload", arg0, arg1) ret := m.ctrl.Call(m, "Upload", arg0, arg1)
@ -139,7 +140,7 @@ func (m *MockAzBlob) Upload(arg0 context.Context, arg1 io.ReadSeeker) error {
return ret0 return ret0
} }
// Upload indicates an expected call of Upload // Upload indicates an expected call of Upload.
func (mr *MockAzBlobMockRecorder) Upload(arg0, arg1 interface{}) *gomock.Call { func (mr *MockAzBlobMockRecorder) Upload(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upload", reflect.TypeOf((*MockAzBlob)(nil).Upload), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Upload", reflect.TypeOf((*MockAzBlob)(nil).Upload), arg0, arg1)

View File

@ -5,6 +5,7 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"io"
"testing" "testing"
"github.com/Azure/azure-storage-blob-go/azblob" "github.com/Azure/azure-storage-blob-go/azblob"
@ -153,7 +154,7 @@ func TestGetUpload(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1),
) )
@ -189,7 +190,7 @@ func TestGetUploadTooLargeBlob(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
) )
upload, err := store.GetUpload(ctx, mockID) upload, err := store.GetUpload(ctx, mockID)
@ -246,10 +247,10 @@ func TestGetReader(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1),
blockBlob.EXPECT().Download(ctx).Return([]byte(mockReaderData), nil).Times(1), blockBlob.EXPECT().Download(ctx).Return(newReadCloser([]byte(mockReaderData)), nil).Times(1),
) )
upload, err := store.GetUpload(ctx, mockID) upload, err := store.GetUpload(ctx, mockID)
@ -286,7 +287,7 @@ func TestWriteChunk(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(offset, nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(offset, nil).Times(1),
blockBlob.EXPECT().Upload(ctx, bytes.NewReader([]byte(mockReaderData))).Return(nil).Times(1), blockBlob.EXPECT().Upload(ctx, bytes.NewReader([]byte(mockReaderData))).Return(nil).Times(1),
@ -325,7 +326,7 @@ func TestFinishUpload(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(offset, nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(offset, nil).Times(1),
blockBlob.EXPECT().Commit(ctx).Return(nil).Times(1), blockBlob.EXPECT().Commit(ctx).Return(nil).Times(1),
@ -362,7 +363,7 @@ func TestTerminate(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1),
infoBlob.EXPECT().Delete(ctx).Return(nil).Times(1), infoBlob.EXPECT().Delete(ctx).Return(nil).Times(1),
@ -405,7 +406,7 @@ func TestDeclareLength(t *testing.T) {
gomock.InOrder( gomock.InOrder(
service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID+".info").Return(infoBlob, nil).Times(1),
infoBlob.EXPECT().Download(ctx).Return(data, nil).Times(1), infoBlob.EXPECT().Download(ctx).Return(newReadCloser(data), nil).Times(1),
service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1), service.EXPECT().NewBlob(ctx, mockID).Return(blockBlob, nil).Times(1),
blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1), blockBlob.EXPECT().GetOffset(ctx).Return(int64(0), nil).Times(1),
infoBlob.EXPECT().Upload(ctx, r).Return(nil).Times(1), infoBlob.EXPECT().Upload(ctx, r).Return(nil).Times(1),
@ -424,3 +425,7 @@ func TestDeclareLength(t *testing.T) {
cancel() cancel()
} }
func newReadCloser(b []byte) io.ReadCloser {
return io.NopCloser(bytes.NewReader(b))
}

View File

@ -167,7 +167,7 @@ func (upload *fileUpload) WriteChunk(ctx context.Context, offset int64, src io.R
return n, err return n, err
} }
func (upload *fileUpload) GetReader(ctx context.Context) (io.Reader, error) { func (upload *fileUpload) GetReader(ctx context.Context) (io.ReadCloser, error) {
return os.Open(upload.binPath) return os.Open(upload.binPath)
} }

View File

@ -325,7 +325,7 @@ func (upload gcsUpload) Terminate(ctx context.Context) error {
return nil return nil
} }
func (upload gcsUpload) GetReader(ctx context.Context) (io.Reader, error) { func (upload gcsUpload) GetReader(ctx context.Context) (io.ReadCloser, error) {
id := upload.id id := upload.id
store := upload.store store := upload.store
@ -334,12 +334,7 @@ func (upload gcsUpload) GetReader(ctx context.Context) (io.Reader, error) {
ID: store.keyWithPrefix(id), ID: store.keyWithPrefix(id),
} }
r, err := store.Service.ReadObject(ctx, params) return store.Service.ReadObject(ctx, params)
if err != nil {
return nil, err
}
return r, nil
} }
func (store GCSStore) keyWithPrefix(key string) string { func (store GCSStore) keyWithPrefix(key string) string {

View File

@ -6,36 +6,37 @@ package gcsstore_test
import ( import (
context "context" context "context"
gomock "github.com/golang/mock/gomock"
gcsstore "github.com/tus/tusd/pkg/gcsstore"
io "io" io "io"
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock"
gcsstore "github.com/tus/tusd/pkg/gcsstore"
) )
// MockGCSReader is a mock of GCSReader interface // MockGCSReader is a mock of GCSReader interface.
type MockGCSReader struct { type MockGCSReader struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockGCSReaderMockRecorder recorder *MockGCSReaderMockRecorder
} }
// MockGCSReaderMockRecorder is the mock recorder for MockGCSReader // MockGCSReaderMockRecorder is the mock recorder for MockGCSReader.
type MockGCSReaderMockRecorder struct { type MockGCSReaderMockRecorder struct {
mock *MockGCSReader mock *MockGCSReader
} }
// NewMockGCSReader creates a new mock instance // NewMockGCSReader creates a new mock instance.
func NewMockGCSReader(ctrl *gomock.Controller) *MockGCSReader { func NewMockGCSReader(ctrl *gomock.Controller) *MockGCSReader {
mock := &MockGCSReader{ctrl: ctrl} mock := &MockGCSReader{ctrl: ctrl}
mock.recorder = &MockGCSReaderMockRecorder{mock} mock.recorder = &MockGCSReaderMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockGCSReader) EXPECT() *MockGCSReaderMockRecorder { func (m *MockGCSReader) EXPECT() *MockGCSReaderMockRecorder {
return m.recorder return m.recorder
} }
// Close mocks base method // Close mocks base method.
func (m *MockGCSReader) Close() error { func (m *MockGCSReader) Close() error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close") ret := m.ctrl.Call(m, "Close")
@ -43,13 +44,13 @@ func (m *MockGCSReader) Close() error {
return ret0 return ret0
} }
// Close indicates an expected call of Close // Close indicates an expected call of Close.
func (mr *MockGCSReaderMockRecorder) Close() *gomock.Call { func (mr *MockGCSReaderMockRecorder) Close() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockGCSReader)(nil).Close)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockGCSReader)(nil).Close))
} }
// ContentType mocks base method // ContentType mocks base method.
func (m *MockGCSReader) ContentType() string { func (m *MockGCSReader) ContentType() string {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ContentType") ret := m.ctrl.Call(m, "ContentType")
@ -57,13 +58,13 @@ func (m *MockGCSReader) ContentType() string {
return ret0 return ret0
} }
// ContentType indicates an expected call of ContentType // ContentType indicates an expected call of ContentType.
func (mr *MockGCSReaderMockRecorder) ContentType() *gomock.Call { func (mr *MockGCSReaderMockRecorder) ContentType() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContentType", reflect.TypeOf((*MockGCSReader)(nil).ContentType)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ContentType", reflect.TypeOf((*MockGCSReader)(nil).ContentType))
} }
// Read mocks base method // Read mocks base method.
func (m *MockGCSReader) Read(arg0 []byte) (int, error) { func (m *MockGCSReader) Read(arg0 []byte) (int, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Read", arg0) ret := m.ctrl.Call(m, "Read", arg0)
@ -72,13 +73,13 @@ func (m *MockGCSReader) Read(arg0 []byte) (int, error) {
return ret0, ret1 return ret0, ret1
} }
// Read indicates an expected call of Read // Read indicates an expected call of Read.
func (mr *MockGCSReaderMockRecorder) Read(arg0 interface{}) *gomock.Call { func (mr *MockGCSReaderMockRecorder) Read(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockGCSReader)(nil).Read), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockGCSReader)(nil).Read), arg0)
} }
// Remain mocks base method // Remain mocks base method.
func (m *MockGCSReader) Remain() int64 { func (m *MockGCSReader) Remain() int64 {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Remain") ret := m.ctrl.Call(m, "Remain")
@ -86,13 +87,13 @@ func (m *MockGCSReader) Remain() int64 {
return ret0 return ret0
} }
// Remain indicates an expected call of Remain // Remain indicates an expected call of Remain.
func (mr *MockGCSReaderMockRecorder) Remain() *gomock.Call { func (mr *MockGCSReaderMockRecorder) Remain() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remain", reflect.TypeOf((*MockGCSReader)(nil).Remain)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Remain", reflect.TypeOf((*MockGCSReader)(nil).Remain))
} }
// Size mocks base method // Size mocks base method.
func (m *MockGCSReader) Size() int64 { func (m *MockGCSReader) Size() int64 {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Size") ret := m.ctrl.Call(m, "Size")
@ -100,36 +101,36 @@ func (m *MockGCSReader) Size() int64 {
return ret0 return ret0
} }
// Size indicates an expected call of Size // Size indicates an expected call of Size.
func (mr *MockGCSReaderMockRecorder) Size() *gomock.Call { func (mr *MockGCSReaderMockRecorder) Size() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockGCSReader)(nil).Size)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Size", reflect.TypeOf((*MockGCSReader)(nil).Size))
} }
// MockGCSAPI is a mock of GCSAPI interface // MockGCSAPI is a mock of GCSAPI interface.
type MockGCSAPI struct { type MockGCSAPI struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockGCSAPIMockRecorder recorder *MockGCSAPIMockRecorder
} }
// MockGCSAPIMockRecorder is the mock recorder for MockGCSAPI // MockGCSAPIMockRecorder is the mock recorder for MockGCSAPI.
type MockGCSAPIMockRecorder struct { type MockGCSAPIMockRecorder struct {
mock *MockGCSAPI mock *MockGCSAPI
} }
// NewMockGCSAPI creates a new mock instance // NewMockGCSAPI creates a new mock instance.
func NewMockGCSAPI(ctrl *gomock.Controller) *MockGCSAPI { func NewMockGCSAPI(ctrl *gomock.Controller) *MockGCSAPI {
mock := &MockGCSAPI{ctrl: ctrl} mock := &MockGCSAPI{ctrl: ctrl}
mock.recorder = &MockGCSAPIMockRecorder{mock} mock.recorder = &MockGCSAPIMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockGCSAPI) EXPECT() *MockGCSAPIMockRecorder { func (m *MockGCSAPI) EXPECT() *MockGCSAPIMockRecorder {
return m.recorder return m.recorder
} }
// ComposeObjects mocks base method // ComposeObjects mocks base method.
func (m *MockGCSAPI) ComposeObjects(arg0 context.Context, arg1 gcsstore.GCSComposeParams) error { func (m *MockGCSAPI) ComposeObjects(arg0 context.Context, arg1 gcsstore.GCSComposeParams) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ComposeObjects", arg0, arg1) ret := m.ctrl.Call(m, "ComposeObjects", arg0, arg1)
@ -137,13 +138,13 @@ func (m *MockGCSAPI) ComposeObjects(arg0 context.Context, arg1 gcsstore.GCSCompo
return ret0 return ret0
} }
// ComposeObjects indicates an expected call of ComposeObjects // ComposeObjects indicates an expected call of ComposeObjects.
func (mr *MockGCSAPIMockRecorder) ComposeObjects(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) ComposeObjects(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComposeObjects", reflect.TypeOf((*MockGCSAPI)(nil).ComposeObjects), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ComposeObjects", reflect.TypeOf((*MockGCSAPI)(nil).ComposeObjects), arg0, arg1)
} }
// DeleteObject mocks base method // DeleteObject mocks base method.
func (m *MockGCSAPI) DeleteObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams) error { func (m *MockGCSAPI) DeleteObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteObject", arg0, arg1) ret := m.ctrl.Call(m, "DeleteObject", arg0, arg1)
@ -151,13 +152,13 @@ func (m *MockGCSAPI) DeleteObject(arg0 context.Context, arg1 gcsstore.GCSObjectP
return ret0 return ret0
} }
// DeleteObject indicates an expected call of DeleteObject // DeleteObject indicates an expected call of DeleteObject.
func (mr *MockGCSAPIMockRecorder) DeleteObject(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) DeleteObject(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockGCSAPI)(nil).DeleteObject), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockGCSAPI)(nil).DeleteObject), arg0, arg1)
} }
// DeleteObjectsWithFilter mocks base method // DeleteObjectsWithFilter mocks base method.
func (m *MockGCSAPI) DeleteObjectsWithFilter(arg0 context.Context, arg1 gcsstore.GCSFilterParams) error { func (m *MockGCSAPI) DeleteObjectsWithFilter(arg0 context.Context, arg1 gcsstore.GCSFilterParams) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteObjectsWithFilter", arg0, arg1) ret := m.ctrl.Call(m, "DeleteObjectsWithFilter", arg0, arg1)
@ -165,13 +166,13 @@ func (m *MockGCSAPI) DeleteObjectsWithFilter(arg0 context.Context, arg1 gcsstore
return ret0 return ret0
} }
// DeleteObjectsWithFilter indicates an expected call of DeleteObjectsWithFilter // DeleteObjectsWithFilter indicates an expected call of DeleteObjectsWithFilter.
func (mr *MockGCSAPIMockRecorder) DeleteObjectsWithFilter(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) DeleteObjectsWithFilter(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectsWithFilter", reflect.TypeOf((*MockGCSAPI)(nil).DeleteObjectsWithFilter), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectsWithFilter", reflect.TypeOf((*MockGCSAPI)(nil).DeleteObjectsWithFilter), arg0, arg1)
} }
// FilterObjects mocks base method // FilterObjects mocks base method.
func (m *MockGCSAPI) FilterObjects(arg0 context.Context, arg1 gcsstore.GCSFilterParams) ([]string, error) { func (m *MockGCSAPI) FilterObjects(arg0 context.Context, arg1 gcsstore.GCSFilterParams) ([]string, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FilterObjects", arg0, arg1) ret := m.ctrl.Call(m, "FilterObjects", arg0, arg1)
@ -180,13 +181,13 @@ func (m *MockGCSAPI) FilterObjects(arg0 context.Context, arg1 gcsstore.GCSFilter
return ret0, ret1 return ret0, ret1
} }
// FilterObjects indicates an expected call of FilterObjects // FilterObjects indicates an expected call of FilterObjects.
func (mr *MockGCSAPIMockRecorder) FilterObjects(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) FilterObjects(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FilterObjects", reflect.TypeOf((*MockGCSAPI)(nil).FilterObjects), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FilterObjects", reflect.TypeOf((*MockGCSAPI)(nil).FilterObjects), arg0, arg1)
} }
// GetObjectSize mocks base method // GetObjectSize mocks base method.
func (m *MockGCSAPI) GetObjectSize(arg0 context.Context, arg1 gcsstore.GCSObjectParams) (int64, error) { func (m *MockGCSAPI) GetObjectSize(arg0 context.Context, arg1 gcsstore.GCSObjectParams) (int64, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetObjectSize", arg0, arg1) ret := m.ctrl.Call(m, "GetObjectSize", arg0, arg1)
@ -195,13 +196,13 @@ func (m *MockGCSAPI) GetObjectSize(arg0 context.Context, arg1 gcsstore.GCSObject
return ret0, ret1 return ret0, ret1
} }
// GetObjectSize indicates an expected call of GetObjectSize // GetObjectSize indicates an expected call of GetObjectSize.
func (mr *MockGCSAPIMockRecorder) GetObjectSize(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) GetObjectSize(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectSize", reflect.TypeOf((*MockGCSAPI)(nil).GetObjectSize), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectSize", reflect.TypeOf((*MockGCSAPI)(nil).GetObjectSize), arg0, arg1)
} }
// ReadObject mocks base method // ReadObject mocks base method.
func (m *MockGCSAPI) ReadObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams) (gcsstore.GCSReader, error) { func (m *MockGCSAPI) ReadObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams) (gcsstore.GCSReader, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ReadObject", arg0, arg1) ret := m.ctrl.Call(m, "ReadObject", arg0, arg1)
@ -210,13 +211,13 @@ func (m *MockGCSAPI) ReadObject(arg0 context.Context, arg1 gcsstore.GCSObjectPar
return ret0, ret1 return ret0, ret1
} }
// ReadObject indicates an expected call of ReadObject // ReadObject indicates an expected call of ReadObject.
func (mr *MockGCSAPIMockRecorder) ReadObject(arg0, arg1 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) ReadObject(arg0, arg1 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadObject", reflect.TypeOf((*MockGCSAPI)(nil).ReadObject), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadObject", reflect.TypeOf((*MockGCSAPI)(nil).ReadObject), arg0, arg1)
} }
// SetObjectMetadata mocks base method // SetObjectMetadata mocks base method.
func (m *MockGCSAPI) SetObjectMetadata(arg0 context.Context, arg1 gcsstore.GCSObjectParams, arg2 map[string]string) error { func (m *MockGCSAPI) SetObjectMetadata(arg0 context.Context, arg1 gcsstore.GCSObjectParams, arg2 map[string]string) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetObjectMetadata", arg0, arg1, arg2) ret := m.ctrl.Call(m, "SetObjectMetadata", arg0, arg1, arg2)
@ -224,13 +225,13 @@ func (m *MockGCSAPI) SetObjectMetadata(arg0 context.Context, arg1 gcsstore.GCSOb
return ret0 return ret0
} }
// SetObjectMetadata indicates an expected call of SetObjectMetadata // SetObjectMetadata indicates an expected call of SetObjectMetadata.
func (mr *MockGCSAPIMockRecorder) SetObjectMetadata(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) SetObjectMetadata(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetObjectMetadata", reflect.TypeOf((*MockGCSAPI)(nil).SetObjectMetadata), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetObjectMetadata", reflect.TypeOf((*MockGCSAPI)(nil).SetObjectMetadata), arg0, arg1, arg2)
} }
// WriteObject mocks base method // WriteObject mocks base method.
func (m *MockGCSAPI) WriteObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams, arg2 io.Reader) (int64, error) { func (m *MockGCSAPI) WriteObject(arg0 context.Context, arg1 gcsstore.GCSObjectParams, arg2 io.Reader) (int64, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WriteObject", arg0, arg1, arg2) ret := m.ctrl.Call(m, "WriteObject", arg0, arg1, arg2)
@ -239,7 +240,7 @@ func (m *MockGCSAPI) WriteObject(arg0 context.Context, arg1 gcsstore.GCSObjectPa
return ret0, ret1 return ret0, ret1
} }
// WriteObject indicates an expected call of WriteObject // WriteObject indicates an expected call of WriteObject.
func (mr *MockGCSAPIMockRecorder) WriteObject(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockGCSAPIMockRecorder) WriteObject(arg0, arg1, arg2 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteObject", reflect.TypeOf((*MockGCSAPI)(nil).WriteObject), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteObject", reflect.TypeOf((*MockGCSAPI)(nil).WriteObject), arg0, arg1, arg2)

View File

@ -63,14 +63,12 @@ type Upload interface {
// requests. It may return an os.ErrNotExist which will be interpreted as a // requests. It may return an os.ErrNotExist which will be interpreted as a
// 404 Not Found. // 404 Not Found.
GetInfo(ctx context.Context) (FileInfo, error) GetInfo(ctx context.Context) (FileInfo, error)
// GetReader returns a reader which allows iterating of the content of an // GetReader returns an io.ReadCloser which allows iterating of the content of an
// upload specified by its ID. It should attempt to provide a reader even if // upload specified by its ID. It should attempt to provide a reader even if
// the upload has not been finished yet but it's not required. // the upload has not been finished yet but it's not required.
// If the returned reader also implements the io.Closer interface, the
// Close() method will be invoked once everything has been read.
// If the given upload could not be found, the error tusd.ErrNotFound should // If the given upload could not be found, the error tusd.ErrNotFound should
// be returned. // be returned.
GetReader(ctx context.Context) (io.Reader, error) GetReader(ctx context.Context) (io.ReadCloser, error)
// FinisherDataStore is the interface which can be implemented by DataStores // FinisherDataStore is the interface which can be implemented by DataStores
// which need to do additional operations once an entire upload has been // which need to do additional operations once an entire upload has been
// completed. These tasks may include but are not limited to freeing unused // completed. These tasks may include but are not limited to freeing unused

View File

@ -6,51 +6,79 @@ package handler_test
import ( import (
context "context" context "context"
gomock "github.com/golang/mock/gomock"
handler "github.com/tus/tusd/pkg/handler"
io "io" io "io"
reflect "reflect" reflect "reflect"
gomock "github.com/golang/mock/gomock"
handler "github.com/tus/tusd/pkg/handler"
) )
// MockFullDataStore is a mock of FullDataStore interface // MockFullDataStore is a mock of FullDataStore interface.
type MockFullDataStore struct { type MockFullDataStore struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockFullDataStoreMockRecorder recorder *MockFullDataStoreMockRecorder
} }
// MockFullDataStoreMockRecorder is the mock recorder for MockFullDataStore // MockFullDataStoreMockRecorder is the mock recorder for MockFullDataStore.
type MockFullDataStoreMockRecorder struct { type MockFullDataStoreMockRecorder struct {
mock *MockFullDataStore mock *MockFullDataStore
} }
// NewMockFullDataStore creates a new mock instance // NewMockFullDataStore creates a new mock instance.
func NewMockFullDataStore(ctrl *gomock.Controller) *MockFullDataStore { func NewMockFullDataStore(ctrl *gomock.Controller) *MockFullDataStore {
mock := &MockFullDataStore{ctrl: ctrl} mock := &MockFullDataStore{ctrl: ctrl}
mock.recorder = &MockFullDataStoreMockRecorder{mock} mock.recorder = &MockFullDataStoreMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockFullDataStore) EXPECT() *MockFullDataStoreMockRecorder { func (m *MockFullDataStore) EXPECT() *MockFullDataStoreMockRecorder {
return m.recorder return m.recorder
} }
// NewUpload mocks base method // AsConcatableUpload mocks base method.
func (m *MockFullDataStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) { func (m *MockFullDataStore) AsConcatableUpload(upload handler.Upload) handler.ConcatableUpload {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NewUpload", ctx, info) ret := m.ctrl.Call(m, "AsConcatableUpload", upload)
ret0, _ := ret[0].(handler.Upload) ret0, _ := ret[0].(handler.ConcatableUpload)
ret1, _ := ret[1].(error) return ret0
return ret0, ret1
} }
// NewUpload indicates an expected call of NewUpload // AsConcatableUpload indicates an expected call of AsConcatableUpload.
func (mr *MockFullDataStoreMockRecorder) NewUpload(ctx, info interface{}) *gomock.Call { func (mr *MockFullDataStoreMockRecorder) AsConcatableUpload(upload interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewUpload", reflect.TypeOf((*MockFullDataStore)(nil).NewUpload), ctx, info) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsConcatableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsConcatableUpload), upload)
} }
// GetUpload mocks base method // AsLengthDeclarableUpload mocks base method.
func (m *MockFullDataStore) AsLengthDeclarableUpload(upload handler.Upload) handler.LengthDeclarableUpload {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AsLengthDeclarableUpload", upload)
ret0, _ := ret[0].(handler.LengthDeclarableUpload)
return ret0
}
// AsLengthDeclarableUpload indicates an expected call of AsLengthDeclarableUpload.
func (mr *MockFullDataStoreMockRecorder) AsLengthDeclarableUpload(upload interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsLengthDeclarableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsLengthDeclarableUpload), upload)
}
// AsTerminatableUpload mocks base method.
func (m *MockFullDataStore) AsTerminatableUpload(upload handler.Upload) handler.TerminatableUpload {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AsTerminatableUpload", upload)
ret0, _ := ret[0].(handler.TerminatableUpload)
return ret0
}
// AsTerminatableUpload indicates an expected call of AsTerminatableUpload.
func (mr *MockFullDataStoreMockRecorder) AsTerminatableUpload(upload interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsTerminatableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsTerminatableUpload), upload)
}
// GetUpload mocks base method.
func (m *MockFullDataStore) GetUpload(ctx context.Context, id string) (handler.Upload, error) { func (m *MockFullDataStore) GetUpload(ctx context.Context, id string) (handler.Upload, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetUpload", ctx, id) ret := m.ctrl.Call(m, "GetUpload", ctx, id)
@ -59,93 +87,93 @@ func (m *MockFullDataStore) GetUpload(ctx context.Context, id string) (handler.U
return ret0, ret1 return ret0, ret1
} }
// GetUpload indicates an expected call of GetUpload // GetUpload indicates an expected call of GetUpload.
func (mr *MockFullDataStoreMockRecorder) GetUpload(ctx, id interface{}) *gomock.Call { func (mr *MockFullDataStoreMockRecorder) GetUpload(ctx, id interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpload", reflect.TypeOf((*MockFullDataStore)(nil).GetUpload), ctx, id) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUpload", reflect.TypeOf((*MockFullDataStore)(nil).GetUpload), ctx, id)
} }
// AsTerminatableUpload mocks base method // NewUpload mocks base method.
func (m *MockFullDataStore) AsTerminatableUpload(upload handler.Upload) handler.TerminatableUpload { func (m *MockFullDataStore) NewUpload(ctx context.Context, info handler.FileInfo) (handler.Upload, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AsTerminatableUpload", upload) ret := m.ctrl.Call(m, "NewUpload", ctx, info)
ret0, _ := ret[0].(handler.TerminatableUpload) ret0, _ := ret[0].(handler.Upload)
return ret0 ret1, _ := ret[1].(error)
return ret0, ret1
} }
// AsTerminatableUpload indicates an expected call of AsTerminatableUpload // NewUpload indicates an expected call of NewUpload.
func (mr *MockFullDataStoreMockRecorder) AsTerminatableUpload(upload interface{}) *gomock.Call { func (mr *MockFullDataStoreMockRecorder) NewUpload(ctx, info interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsTerminatableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsTerminatableUpload), upload) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewUpload", reflect.TypeOf((*MockFullDataStore)(nil).NewUpload), ctx, info)
} }
// AsConcatableUpload mocks base method // MockFullUpload is a mock of FullUpload interface.
func (m *MockFullDataStore) AsConcatableUpload(upload handler.Upload) handler.ConcatableUpload {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AsConcatableUpload", upload)
ret0, _ := ret[0].(handler.ConcatableUpload)
return ret0
}
// AsConcatableUpload indicates an expected call of AsConcatableUpload
func (mr *MockFullDataStoreMockRecorder) AsConcatableUpload(upload interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsConcatableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsConcatableUpload), upload)
}
// AsLengthDeclarableUpload mocks base method
func (m *MockFullDataStore) AsLengthDeclarableUpload(upload handler.Upload) handler.LengthDeclarableUpload {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AsLengthDeclarableUpload", upload)
ret0, _ := ret[0].(handler.LengthDeclarableUpload)
return ret0
}
// AsLengthDeclarableUpload indicates an expected call of AsLengthDeclarableUpload
func (mr *MockFullDataStoreMockRecorder) AsLengthDeclarableUpload(upload interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AsLengthDeclarableUpload", reflect.TypeOf((*MockFullDataStore)(nil).AsLengthDeclarableUpload), upload)
}
// MockFullUpload is a mock of FullUpload interface
type MockFullUpload struct { type MockFullUpload struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockFullUploadMockRecorder recorder *MockFullUploadMockRecorder
} }
// MockFullUploadMockRecorder is the mock recorder for MockFullUpload // MockFullUploadMockRecorder is the mock recorder for MockFullUpload.
type MockFullUploadMockRecorder struct { type MockFullUploadMockRecorder struct {
mock *MockFullUpload mock *MockFullUpload
} }
// NewMockFullUpload creates a new mock instance // NewMockFullUpload creates a new mock instance.
func NewMockFullUpload(ctrl *gomock.Controller) *MockFullUpload { func NewMockFullUpload(ctrl *gomock.Controller) *MockFullUpload {
mock := &MockFullUpload{ctrl: ctrl} mock := &MockFullUpload{ctrl: ctrl}
mock.recorder = &MockFullUploadMockRecorder{mock} mock.recorder = &MockFullUploadMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockFullUpload) EXPECT() *MockFullUploadMockRecorder { func (m *MockFullUpload) EXPECT() *MockFullUploadMockRecorder {
return m.recorder return m.recorder
} }
// WriteChunk mocks base method // ConcatUploads mocks base method.
func (m *MockFullUpload) WriteChunk(ctx context.Context, offset int64, src io.Reader) (int64, error) { func (m *MockFullUpload) ConcatUploads(ctx context.Context, partialUploads []handler.Upload) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WriteChunk", ctx, offset, src) ret := m.ctrl.Call(m, "ConcatUploads", ctx, partialUploads)
ret0, _ := ret[0].(int64) ret0, _ := ret[0].(error)
ret1, _ := ret[1].(error) return ret0
return ret0, ret1
} }
// WriteChunk indicates an expected call of WriteChunk // ConcatUploads indicates an expected call of ConcatUploads.
func (mr *MockFullUploadMockRecorder) WriteChunk(ctx, offset, src interface{}) *gomock.Call { func (mr *MockFullUploadMockRecorder) ConcatUploads(ctx, partialUploads interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteChunk", reflect.TypeOf((*MockFullUpload)(nil).WriteChunk), ctx, offset, src) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConcatUploads", reflect.TypeOf((*MockFullUpload)(nil).ConcatUploads), ctx, partialUploads)
} }
// GetInfo mocks base method // DeclareLength mocks base method.
func (m *MockFullUpload) DeclareLength(ctx context.Context, length int64) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeclareLength", ctx, length)
ret0, _ := ret[0].(error)
return ret0
}
// DeclareLength indicates an expected call of DeclareLength.
func (mr *MockFullUploadMockRecorder) DeclareLength(ctx, length interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeclareLength", reflect.TypeOf((*MockFullUpload)(nil).DeclareLength), ctx, length)
}
// FinishUpload mocks base method.
func (m *MockFullUpload) FinishUpload(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FinishUpload", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// FinishUpload indicates an expected call of FinishUpload.
func (mr *MockFullUploadMockRecorder) FinishUpload(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinishUpload", reflect.TypeOf((*MockFullUpload)(nil).FinishUpload), ctx)
}
// GetInfo mocks base method.
func (m *MockFullUpload) GetInfo(ctx context.Context) (handler.FileInfo, error) { func (m *MockFullUpload) GetInfo(ctx context.Context) (handler.FileInfo, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetInfo", ctx) ret := m.ctrl.Call(m, "GetInfo", ctx)
@ -154,42 +182,28 @@ func (m *MockFullUpload) GetInfo(ctx context.Context) (handler.FileInfo, error)
return ret0, ret1 return ret0, ret1
} }
// GetInfo indicates an expected call of GetInfo // GetInfo indicates an expected call of GetInfo.
func (mr *MockFullUploadMockRecorder) GetInfo(ctx interface{}) *gomock.Call { func (mr *MockFullUploadMockRecorder) GetInfo(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInfo", reflect.TypeOf((*MockFullUpload)(nil).GetInfo), ctx) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetInfo", reflect.TypeOf((*MockFullUpload)(nil).GetInfo), ctx)
} }
// GetReader mocks base method // GetReader mocks base method.
func (m *MockFullUpload) GetReader(ctx context.Context) (io.Reader, error) { func (m *MockFullUpload) GetReader(ctx context.Context) (io.ReadCloser, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetReader", ctx) ret := m.ctrl.Call(m, "GetReader", ctx)
ret0, _ := ret[0].(io.Reader) ret0, _ := ret[0].(io.ReadCloser)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// GetReader indicates an expected call of GetReader // GetReader indicates an expected call of GetReader.
func (mr *MockFullUploadMockRecorder) GetReader(ctx interface{}) *gomock.Call { func (mr *MockFullUploadMockRecorder) GetReader(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReader", reflect.TypeOf((*MockFullUpload)(nil).GetReader), ctx) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReader", reflect.TypeOf((*MockFullUpload)(nil).GetReader), ctx)
} }
// FinishUpload mocks base method // Terminate mocks base method.
func (m *MockFullUpload) FinishUpload(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "FinishUpload", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// FinishUpload indicates an expected call of FinishUpload
func (mr *MockFullUploadMockRecorder) FinishUpload(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FinishUpload", reflect.TypeOf((*MockFullUpload)(nil).FinishUpload), ctx)
}
// Terminate mocks base method
func (m *MockFullUpload) Terminate(ctx context.Context) error { func (m *MockFullUpload) Terminate(ctx context.Context) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Terminate", ctx) ret := m.ctrl.Call(m, "Terminate", ctx)
@ -197,64 +211,51 @@ func (m *MockFullUpload) Terminate(ctx context.Context) error {
return ret0 return ret0
} }
// Terminate indicates an expected call of Terminate // Terminate indicates an expected call of Terminate.
func (mr *MockFullUploadMockRecorder) Terminate(ctx interface{}) *gomock.Call { func (mr *MockFullUploadMockRecorder) Terminate(ctx interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Terminate", reflect.TypeOf((*MockFullUpload)(nil).Terminate), ctx) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Terminate", reflect.TypeOf((*MockFullUpload)(nil).Terminate), ctx)
} }
// DeclareLength mocks base method // WriteChunk mocks base method.
func (m *MockFullUpload) DeclareLength(ctx context.Context, length int64) error { func (m *MockFullUpload) WriteChunk(ctx context.Context, offset int64, src io.Reader) (int64, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeclareLength", ctx, length) ret := m.ctrl.Call(m, "WriteChunk", ctx, offset, src)
ret0, _ := ret[0].(error) ret0, _ := ret[0].(int64)
return ret0 ret1, _ := ret[1].(error)
return ret0, ret1
} }
// DeclareLength indicates an expected call of DeclareLength // WriteChunk indicates an expected call of WriteChunk.
func (mr *MockFullUploadMockRecorder) DeclareLength(ctx, length interface{}) *gomock.Call { func (mr *MockFullUploadMockRecorder) WriteChunk(ctx, offset, src interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeclareLength", reflect.TypeOf((*MockFullUpload)(nil).DeclareLength), ctx, length) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WriteChunk", reflect.TypeOf((*MockFullUpload)(nil).WriteChunk), ctx, offset, src)
} }
// ConcatUploads mocks base method // MockFullLocker is a mock of FullLocker interface.
func (m *MockFullUpload) ConcatUploads(ctx context.Context, partialUploads []handler.Upload) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ConcatUploads", ctx, partialUploads)
ret0, _ := ret[0].(error)
return ret0
}
// ConcatUploads indicates an expected call of ConcatUploads
func (mr *MockFullUploadMockRecorder) ConcatUploads(ctx, partialUploads interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConcatUploads", reflect.TypeOf((*MockFullUpload)(nil).ConcatUploads), ctx, partialUploads)
}
// MockFullLocker is a mock of FullLocker interface
type MockFullLocker struct { type MockFullLocker struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockFullLockerMockRecorder recorder *MockFullLockerMockRecorder
} }
// MockFullLockerMockRecorder is the mock recorder for MockFullLocker // MockFullLockerMockRecorder is the mock recorder for MockFullLocker.
type MockFullLockerMockRecorder struct { type MockFullLockerMockRecorder struct {
mock *MockFullLocker mock *MockFullLocker
} }
// NewMockFullLocker creates a new mock instance // NewMockFullLocker creates a new mock instance.
func NewMockFullLocker(ctrl *gomock.Controller) *MockFullLocker { func NewMockFullLocker(ctrl *gomock.Controller) *MockFullLocker {
mock := &MockFullLocker{ctrl: ctrl} mock := &MockFullLocker{ctrl: ctrl}
mock.recorder = &MockFullLockerMockRecorder{mock} mock.recorder = &MockFullLockerMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockFullLocker) EXPECT() *MockFullLockerMockRecorder { func (m *MockFullLocker) EXPECT() *MockFullLockerMockRecorder {
return m.recorder return m.recorder
} }
// NewLock mocks base method // NewLock mocks base method.
func (m *MockFullLocker) NewLock(id string) (handler.Lock, error) { func (m *MockFullLocker) NewLock(id string) (handler.Lock, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "NewLock", id) ret := m.ctrl.Call(m, "NewLock", id)
@ -263,36 +264,36 @@ func (m *MockFullLocker) NewLock(id string) (handler.Lock, error) {
return ret0, ret1 return ret0, ret1
} }
// NewLock indicates an expected call of NewLock // NewLock indicates an expected call of NewLock.
func (mr *MockFullLockerMockRecorder) NewLock(id interface{}) *gomock.Call { func (mr *MockFullLockerMockRecorder) NewLock(id interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewLock", reflect.TypeOf((*MockFullLocker)(nil).NewLock), id) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewLock", reflect.TypeOf((*MockFullLocker)(nil).NewLock), id)
} }
// MockFullLock is a mock of FullLock interface // MockFullLock is a mock of FullLock interface.
type MockFullLock struct { type MockFullLock struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockFullLockMockRecorder recorder *MockFullLockMockRecorder
} }
// MockFullLockMockRecorder is the mock recorder for MockFullLock // MockFullLockMockRecorder is the mock recorder for MockFullLock.
type MockFullLockMockRecorder struct { type MockFullLockMockRecorder struct {
mock *MockFullLock mock *MockFullLock
} }
// NewMockFullLock creates a new mock instance // NewMockFullLock creates a new mock instance.
func NewMockFullLock(ctrl *gomock.Controller) *MockFullLock { func NewMockFullLock(ctrl *gomock.Controller) *MockFullLock {
mock := &MockFullLock{ctrl: ctrl} mock := &MockFullLock{ctrl: ctrl}
mock.recorder = &MockFullLockMockRecorder{mock} mock.recorder = &MockFullLockMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockFullLock) EXPECT() *MockFullLockMockRecorder { func (m *MockFullLock) EXPECT() *MockFullLockMockRecorder {
return m.recorder return m.recorder
} }
// Lock mocks base method // Lock mocks base method.
func (m *MockFullLock) Lock(ctx context.Context, requestUnlock func()) error { func (m *MockFullLock) Lock(ctx context.Context, requestUnlock func()) error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Lock", ctx, requestUnlock) ret := m.ctrl.Call(m, "Lock", ctx, requestUnlock)
@ -300,13 +301,13 @@ func (m *MockFullLock) Lock(ctx context.Context, requestUnlock func()) error {
return ret0 return ret0
} }
// Lock indicates an expected call of Lock // Lock indicates an expected call of Lock.
func (mr *MockFullLockMockRecorder) Lock(ctx, requestUnlock interface{}) *gomock.Call { func (mr *MockFullLockMockRecorder) Lock(ctx, requestUnlock interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lock", reflect.TypeOf((*MockFullLock)(nil).Lock), ctx, requestUnlock) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Lock", reflect.TypeOf((*MockFullLock)(nil).Lock), ctx, requestUnlock)
} }
// Unlock mocks base method // Unlock mocks base method.
func (m *MockFullLock) Unlock() error { func (m *MockFullLock) Unlock() error {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Unlock") ret := m.ctrl.Call(m, "Unlock")
@ -314,7 +315,7 @@ func (m *MockFullLock) Unlock() error {
return ret0 return ret0
} }
// Unlock indicates an expected call of Unlock // Unlock indicates an expected call of Unlock.
func (mr *MockFullLockMockRecorder) Unlock() *gomock.Call { func (mr *MockFullLockMockRecorder) Unlock() *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockFullLock)(nil).Unlock)) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Unlock", reflect.TypeOf((*MockFullLock)(nil).Unlock))

View File

@ -749,10 +749,7 @@ func (handler *UnroutedHandler) GetFile(w http.ResponseWriter, r *http.Request)
handler.sendResp(c, resp) handler.sendResp(c, resp)
io.Copy(w, src) io.Copy(w, src)
// Try to close the reader if the io.Closer interface is implemented src.Close()
if closer, ok := src.(io.Closer); ok {
closer.Close()
}
} }
// mimeInlineBrowserWhitelist is a map containing MIME types which should be // mimeInlineBrowserWhitelist is a map containing MIME types which should be

View File

@ -13,7 +13,7 @@ import (
"github.com/tus/tusd/pkg/handler" "github.com/tus/tusd/pkg/handler"
) )
//go:generate mockgen -package handler_test -source utils_test.go -aux_files handler=datastore.go -destination=handler_mock_test.go //go:generate mockgen -package handler_test -source utils_test.go -destination=handler_mock_test.go
// FullDataStore is an interface combining most interfaces for data stores. // FullDataStore is an interface combining most interfaces for data stores.
// This is used by mockgen(1) to generate a mocked data store used for testing // This is used by mockgen(1) to generate a mocked data store used for testing

View File

@ -686,7 +686,7 @@ func (upload s3Upload) fetchInfo(ctx context.Context) (info handler.FileInfo, pa
return info, parts, incompletePartSize, nil return info, parts, incompletePartSize, nil
} }
func (upload s3Upload) GetReader(ctx context.Context) (io.Reader, error) { func (upload s3Upload) GetReader(ctx context.Context) (io.ReadCloser, error) {
id := upload.id id := upload.id
store := upload.store store := upload.store
uploadId, multipartId := splitIds(id) uploadId, multipartId := splitIds(id)

View File

@ -13,30 +13,30 @@ import (
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
) )
// MockS3API is a mock of S3API interface // MockS3API is a mock of S3API interface.
type MockS3API struct { type MockS3API struct {
ctrl *gomock.Controller ctrl *gomock.Controller
recorder *MockS3APIMockRecorder recorder *MockS3APIMockRecorder
} }
// MockS3APIMockRecorder is the mock recorder for MockS3API // MockS3APIMockRecorder is the mock recorder for MockS3API.
type MockS3APIMockRecorder struct { type MockS3APIMockRecorder struct {
mock *MockS3API mock *MockS3API
} }
// NewMockS3API creates a new mock instance // NewMockS3API creates a new mock instance.
func NewMockS3API(ctrl *gomock.Controller) *MockS3API { func NewMockS3API(ctrl *gomock.Controller) *MockS3API {
mock := &MockS3API{ctrl: ctrl} mock := &MockS3API{ctrl: ctrl}
mock.recorder = &MockS3APIMockRecorder{mock} mock.recorder = &MockS3APIMockRecorder{mock}
return mock return mock
} }
// EXPECT returns an object that allows the caller to indicate expected use // EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockS3API) EXPECT() *MockS3APIMockRecorder { func (m *MockS3API) EXPECT() *MockS3APIMockRecorder {
return m.recorder return m.recorder
} }
// AbortMultipartUploadWithContext mocks base method // AbortMultipartUploadWithContext mocks base method.
func (m *MockS3API) AbortMultipartUploadWithContext(arg0 context.Context, arg1 *s3.AbortMultipartUploadInput, arg2 ...request.Option) (*s3.AbortMultipartUploadOutput, error) { func (m *MockS3API) AbortMultipartUploadWithContext(arg0 context.Context, arg1 *s3.AbortMultipartUploadInput, arg2 ...request.Option) (*s3.AbortMultipartUploadOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -49,14 +49,14 @@ func (m *MockS3API) AbortMultipartUploadWithContext(arg0 context.Context, arg1 *
return ret0, ret1 return ret0, ret1
} }
// AbortMultipartUploadWithContext indicates an expected call of AbortMultipartUploadWithContext // AbortMultipartUploadWithContext indicates an expected call of AbortMultipartUploadWithContext.
func (mr *MockS3APIMockRecorder) AbortMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) AbortMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AbortMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).AbortMultipartUploadWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AbortMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).AbortMultipartUploadWithContext), varargs...)
} }
// CompleteMultipartUploadWithContext mocks base method // CompleteMultipartUploadWithContext mocks base method.
func (m *MockS3API) CompleteMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CompleteMultipartUploadInput, arg2 ...request.Option) (*s3.CompleteMultipartUploadOutput, error) { func (m *MockS3API) CompleteMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CompleteMultipartUploadInput, arg2 ...request.Option) (*s3.CompleteMultipartUploadOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -69,14 +69,14 @@ func (m *MockS3API) CompleteMultipartUploadWithContext(arg0 context.Context, arg
return ret0, ret1 return ret0, ret1
} }
// CompleteMultipartUploadWithContext indicates an expected call of CompleteMultipartUploadWithContext // CompleteMultipartUploadWithContext indicates an expected call of CompleteMultipartUploadWithContext.
func (mr *MockS3APIMockRecorder) CompleteMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) CompleteMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CompleteMultipartUploadWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CompleteMultipartUploadWithContext), varargs...)
} }
// CreateMultipartUploadWithContext mocks base method // CreateMultipartUploadWithContext mocks base method.
func (m *MockS3API) CreateMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CreateMultipartUploadInput, arg2 ...request.Option) (*s3.CreateMultipartUploadOutput, error) { func (m *MockS3API) CreateMultipartUploadWithContext(arg0 context.Context, arg1 *s3.CreateMultipartUploadInput, arg2 ...request.Option) (*s3.CreateMultipartUploadOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -89,14 +89,14 @@ func (m *MockS3API) CreateMultipartUploadWithContext(arg0 context.Context, arg1
return ret0, ret1 return ret0, ret1
} }
// CreateMultipartUploadWithContext indicates an expected call of CreateMultipartUploadWithContext // CreateMultipartUploadWithContext indicates an expected call of CreateMultipartUploadWithContext.
func (mr *MockS3APIMockRecorder) CreateMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) CreateMultipartUploadWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CreateMultipartUploadWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateMultipartUploadWithContext", reflect.TypeOf((*MockS3API)(nil).CreateMultipartUploadWithContext), varargs...)
} }
// DeleteObjectWithContext mocks base method // DeleteObjectWithContext mocks base method.
func (m *MockS3API) DeleteObjectWithContext(arg0 context.Context, arg1 *s3.DeleteObjectInput, arg2 ...request.Option) (*s3.DeleteObjectOutput, error) { func (m *MockS3API) DeleteObjectWithContext(arg0 context.Context, arg1 *s3.DeleteObjectInput, arg2 ...request.Option) (*s3.DeleteObjectOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -109,14 +109,14 @@ func (m *MockS3API) DeleteObjectWithContext(arg0 context.Context, arg1 *s3.Delet
return ret0, ret1 return ret0, ret1
} }
// DeleteObjectWithContext indicates an expected call of DeleteObjectWithContext // DeleteObjectWithContext indicates an expected call of DeleteObjectWithContext.
func (mr *MockS3APIMockRecorder) DeleteObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) DeleteObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectWithContext), varargs...)
} }
// DeleteObjectsWithContext mocks base method // DeleteObjectsWithContext mocks base method.
func (m *MockS3API) DeleteObjectsWithContext(arg0 context.Context, arg1 *s3.DeleteObjectsInput, arg2 ...request.Option) (*s3.DeleteObjectsOutput, error) { func (m *MockS3API) DeleteObjectsWithContext(arg0 context.Context, arg1 *s3.DeleteObjectsInput, arg2 ...request.Option) (*s3.DeleteObjectsOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -129,14 +129,14 @@ func (m *MockS3API) DeleteObjectsWithContext(arg0 context.Context, arg1 *s3.Dele
return ret0, ret1 return ret0, ret1
} }
// DeleteObjectsWithContext indicates an expected call of DeleteObjectsWithContext // DeleteObjectsWithContext indicates an expected call of DeleteObjectsWithContext.
func (mr *MockS3APIMockRecorder) DeleteObjectsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) DeleteObjectsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectsWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectsWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObjectsWithContext", reflect.TypeOf((*MockS3API)(nil).DeleteObjectsWithContext), varargs...)
} }
// GetObjectWithContext mocks base method // GetObjectWithContext mocks base method.
func (m *MockS3API) GetObjectWithContext(arg0 context.Context, arg1 *s3.GetObjectInput, arg2 ...request.Option) (*s3.GetObjectOutput, error) { func (m *MockS3API) GetObjectWithContext(arg0 context.Context, arg1 *s3.GetObjectInput, arg2 ...request.Option) (*s3.GetObjectOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -149,14 +149,14 @@ func (m *MockS3API) GetObjectWithContext(arg0 context.Context, arg1 *s3.GetObjec
return ret0, ret1 return ret0, ret1
} }
// GetObjectWithContext indicates an expected call of GetObjectWithContext // GetObjectWithContext indicates an expected call of GetObjectWithContext.
func (mr *MockS3APIMockRecorder) GetObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) GetObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectWithContext", reflect.TypeOf((*MockS3API)(nil).GetObjectWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectWithContext", reflect.TypeOf((*MockS3API)(nil).GetObjectWithContext), varargs...)
} }
// HeadObjectWithContext mocks base method // HeadObjectWithContext mocks base method.
func (m *MockS3API) HeadObjectWithContext(arg0 context.Context, arg1 *s3.HeadObjectInput, arg2 ...request.Option) (*s3.HeadObjectOutput, error) { func (m *MockS3API) HeadObjectWithContext(arg0 context.Context, arg1 *s3.HeadObjectInput, arg2 ...request.Option) (*s3.HeadObjectOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -169,14 +169,14 @@ func (m *MockS3API) HeadObjectWithContext(arg0 context.Context, arg1 *s3.HeadObj
return ret0, ret1 return ret0, ret1
} }
// HeadObjectWithContext indicates an expected call of HeadObjectWithContext // HeadObjectWithContext indicates an expected call of HeadObjectWithContext.
func (mr *MockS3APIMockRecorder) HeadObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) HeadObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeadObjectWithContext", reflect.TypeOf((*MockS3API)(nil).HeadObjectWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeadObjectWithContext", reflect.TypeOf((*MockS3API)(nil).HeadObjectWithContext), varargs...)
} }
// ListPartsWithContext mocks base method // ListPartsWithContext mocks base method.
func (m *MockS3API) ListPartsWithContext(arg0 context.Context, arg1 *s3.ListPartsInput, arg2 ...request.Option) (*s3.ListPartsOutput, error) { func (m *MockS3API) ListPartsWithContext(arg0 context.Context, arg1 *s3.ListPartsInput, arg2 ...request.Option) (*s3.ListPartsOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -189,14 +189,14 @@ func (m *MockS3API) ListPartsWithContext(arg0 context.Context, arg1 *s3.ListPart
return ret0, ret1 return ret0, ret1
} }
// ListPartsWithContext indicates an expected call of ListPartsWithContext // ListPartsWithContext indicates an expected call of ListPartsWithContext.
func (mr *MockS3APIMockRecorder) ListPartsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) ListPartsWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPartsWithContext", reflect.TypeOf((*MockS3API)(nil).ListPartsWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListPartsWithContext", reflect.TypeOf((*MockS3API)(nil).ListPartsWithContext), varargs...)
} }
// PutObjectWithContext mocks base method // PutObjectWithContext mocks base method.
func (m *MockS3API) PutObjectWithContext(arg0 context.Context, arg1 *s3.PutObjectInput, arg2 ...request.Option) (*s3.PutObjectOutput, error) { func (m *MockS3API) PutObjectWithContext(arg0 context.Context, arg1 *s3.PutObjectInput, arg2 ...request.Option) (*s3.PutObjectOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -209,14 +209,14 @@ func (m *MockS3API) PutObjectWithContext(arg0 context.Context, arg1 *s3.PutObjec
return ret0, ret1 return ret0, ret1
} }
// PutObjectWithContext indicates an expected call of PutObjectWithContext // PutObjectWithContext indicates an expected call of PutObjectWithContext.
func (mr *MockS3APIMockRecorder) PutObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) PutObjectWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObjectWithContext", reflect.TypeOf((*MockS3API)(nil).PutObjectWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObjectWithContext", reflect.TypeOf((*MockS3API)(nil).PutObjectWithContext), varargs...)
} }
// UploadPartCopyWithContext mocks base method // UploadPartCopyWithContext mocks base method.
func (m *MockS3API) UploadPartCopyWithContext(arg0 context.Context, arg1 *s3.UploadPartCopyInput, arg2 ...request.Option) (*s3.UploadPartCopyOutput, error) { func (m *MockS3API) UploadPartCopyWithContext(arg0 context.Context, arg1 *s3.UploadPartCopyInput, arg2 ...request.Option) (*s3.UploadPartCopyOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -229,14 +229,14 @@ func (m *MockS3API) UploadPartCopyWithContext(arg0 context.Context, arg1 *s3.Upl
return ret0, ret1 return ret0, ret1
} }
// UploadPartCopyWithContext indicates an expected call of UploadPartCopyWithContext // UploadPartCopyWithContext indicates an expected call of UploadPartCopyWithContext.
func (mr *MockS3APIMockRecorder) UploadPartCopyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) UploadPartCopyWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadPartCopyWithContext", reflect.TypeOf((*MockS3API)(nil).UploadPartCopyWithContext), varargs...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UploadPartCopyWithContext", reflect.TypeOf((*MockS3API)(nil).UploadPartCopyWithContext), varargs...)
} }
// UploadPartWithContext mocks base method // UploadPartWithContext mocks base method.
func (m *MockS3API) UploadPartWithContext(arg0 context.Context, arg1 *s3.UploadPartInput, arg2 ...request.Option) (*s3.UploadPartOutput, error) { func (m *MockS3API) UploadPartWithContext(arg0 context.Context, arg1 *s3.UploadPartInput, arg2 ...request.Option) (*s3.UploadPartOutput, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
@ -249,7 +249,7 @@ func (m *MockS3API) UploadPartWithContext(arg0 context.Context, arg1 *s3.UploadP
return ret0, ret1 return ret0, ret1
} }
// UploadPartWithContext indicates an expected call of UploadPartWithContext // UploadPartWithContext indicates an expected call of UploadPartWithContext.
func (mr *MockS3APIMockRecorder) UploadPartWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call { func (mr *MockS3APIMockRecorder) UploadPartWithContext(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper() mr.mock.ctrl.T.Helper()
varargs := append([]interface{}{arg0, arg1}, arg2...) varargs := append([]interface{}{arg0, arg1}, arg2...)