mirror of
https://github.com/versity/versitygw.git
synced 2026-01-09 04:53:10 +00:00
feat: added content-length in putObjectPart
This commit is contained in:
@@ -28,7 +28,7 @@ type Backend interface {
|
||||
ListMultipartUploads(output *s3.ListMultipartUploadsInput) (*s3.ListMultipartUploadsOutput, error)
|
||||
ListObjectParts(bucket, object, uploadID string, partNumberMarker int, maxParts int) (*s3.ListPartsOutput, error)
|
||||
CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*types.CopyPartResult, error)
|
||||
PutObjectPart(bucket, object, uploadID string, part int, r io.Reader) (etag string, err error)
|
||||
PutObjectPart(bucket, object, uploadID string, part int, length int64, r io.Reader) (etag string, err error)
|
||||
|
||||
PutObject(bucket, object string, r io.Reader) (string, error)
|
||||
HeadObject(bucket, object string, etag string) (*s3.HeadObjectOutput, error)
|
||||
@@ -116,7 +116,7 @@ func (BackendUnsupported) ListObjectParts(bucket, object, uploadID string, partN
|
||||
func (BackendUnsupported) CopyPart(srcBucket, srcObject, DstBucket, uploadID, rangeHeader string, part int) (*types.CopyPartResult, error) {
|
||||
return nil, s3err.GetAPIError(s3err.ErrNotImplemented)
|
||||
}
|
||||
func (BackendUnsupported) PutObjectPart(bucket, object, uploadID string, part int, r io.Reader) (etag string, err error) {
|
||||
func (BackendUnsupported) PutObjectPart(bucket, object, uploadID string, part int, length int64, r io.Reader) (etag string, err error) {
|
||||
return "", s3err.GetAPIError(s3err.ErrNotImplemented)
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ var _ Backend = &BackendMock{}
|
||||
// PutObjectAclFunc: func(putObjectAclInput *s3.PutObjectAclInput) error {
|
||||
// panic("mock out the PutObjectAcl method")
|
||||
// },
|
||||
// PutObjectPartFunc: func(bucket string, object string, uploadID string, part int, r io.Reader) (string, error) {
|
||||
// PutObjectPartFunc: func(bucket string, object string, uploadID string, part int, length int64, r io.Reader) (string, error) {
|
||||
// panic("mock out the PutObjectPart method")
|
||||
// },
|
||||
// RemoveTagsFunc: func(bucket string, object string) error {
|
||||
@@ -208,7 +208,7 @@ type BackendMock struct {
|
||||
PutObjectAclFunc func(putObjectAclInput *s3.PutObjectAclInput) error
|
||||
|
||||
// PutObjectPartFunc mocks the PutObjectPart method.
|
||||
PutObjectPartFunc func(bucket string, object string, uploadID string, part int, r io.Reader) (string, error)
|
||||
PutObjectPartFunc func(bucket string, object string, uploadID string, part int, length int64, r io.Reader) (string, error)
|
||||
|
||||
// RemoveTagsFunc mocks the RemoveTags method.
|
||||
RemoveTagsFunc func(bucket string, object string) error
|
||||
@@ -443,6 +443,8 @@ type BackendMock struct {
|
||||
UploadID string
|
||||
// Part is the part argument value.
|
||||
Part int
|
||||
// Length is the length argument value.
|
||||
Length int64
|
||||
// R is the r argument value.
|
||||
R io.Reader
|
||||
}
|
||||
@@ -1500,7 +1502,7 @@ func (mock *BackendMock) PutObjectAclCalls() []struct {
|
||||
}
|
||||
|
||||
// PutObjectPart calls PutObjectPartFunc.
|
||||
func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID string, part int, r io.Reader) (string, error) {
|
||||
func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID string, part int, length int64, r io.Reader) (string, error) {
|
||||
if mock.PutObjectPartFunc == nil {
|
||||
panic("BackendMock.PutObjectPartFunc: method is nil but Backend.PutObjectPart was just called")
|
||||
}
|
||||
@@ -1509,18 +1511,20 @@ func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID st
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
}{
|
||||
Bucket: bucket,
|
||||
Object: object,
|
||||
UploadID: uploadID,
|
||||
Part: part,
|
||||
Length: length,
|
||||
R: r,
|
||||
}
|
||||
mock.lockPutObjectPart.Lock()
|
||||
mock.calls.PutObjectPart = append(mock.calls.PutObjectPart, callInfo)
|
||||
mock.lockPutObjectPart.Unlock()
|
||||
return mock.PutObjectPartFunc(bucket, object, uploadID, part, r)
|
||||
return mock.PutObjectPartFunc(bucket, object, uploadID, part, length, r)
|
||||
}
|
||||
|
||||
// PutObjectPartCalls gets all the calls that were made to PutObjectPart.
|
||||
@@ -1532,6 +1536,7 @@ func (mock *BackendMock) PutObjectPartCalls() []struct {
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
} {
|
||||
var calls []struct {
|
||||
@@ -1539,6 +1544,7 @@ func (mock *BackendMock) PutObjectPartCalls() []struct {
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
}
|
||||
mock.lockPutObjectPart.RLock()
|
||||
|
||||
@@ -210,7 +210,7 @@ type BackendMock struct {
|
||||
PutObjectAclFunc func(putObjectAclInput *s3.PutObjectAclInput) error
|
||||
|
||||
// PutObjectPartFunc mocks the PutObjectPart method.
|
||||
PutObjectPartFunc func(bucket string, object string, uploadID string, part int, r io.Reader) (string, error)
|
||||
PutObjectPartFunc func(bucket string, object string, uploadID string, part int, length int64, r io.Reader) (string, error)
|
||||
|
||||
// RemoveTagsFunc mocks the RemoveTags method.
|
||||
RemoveTagsFunc func(bucket string, object string) error
|
||||
@@ -445,6 +445,8 @@ type BackendMock struct {
|
||||
UploadID string
|
||||
// Part is the part argument value.
|
||||
Part int
|
||||
// Length is the length argument value.
|
||||
Length int64
|
||||
// R is the r argument value.
|
||||
R io.Reader
|
||||
}
|
||||
@@ -1502,7 +1504,7 @@ func (mock *BackendMock) PutObjectAclCalls() []struct {
|
||||
}
|
||||
|
||||
// PutObjectPart calls PutObjectPartFunc.
|
||||
func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID string, part int, r io.Reader) (string, error) {
|
||||
func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID string, part int, length int64, r io.Reader) (string, error) {
|
||||
if mock.PutObjectPartFunc == nil {
|
||||
panic("BackendMock.PutObjectPartFunc: method is nil but Backend.PutObjectPart was just called")
|
||||
}
|
||||
@@ -1511,18 +1513,20 @@ func (mock *BackendMock) PutObjectPart(bucket string, object string, uploadID st
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
}{
|
||||
Bucket: bucket,
|
||||
Object: object,
|
||||
UploadID: uploadID,
|
||||
Part: part,
|
||||
Length: length,
|
||||
R: r,
|
||||
}
|
||||
mock.lockPutObjectPart.Lock()
|
||||
mock.calls.PutObjectPart = append(mock.calls.PutObjectPart, callInfo)
|
||||
mock.lockPutObjectPart.Unlock()
|
||||
return mock.PutObjectPartFunc(bucket, object, uploadID, part, r)
|
||||
return mock.PutObjectPartFunc(bucket, object, uploadID, part, length, r)
|
||||
}
|
||||
|
||||
// PutObjectPartCalls gets all the calls that were made to PutObjectPart.
|
||||
@@ -1534,6 +1538,7 @@ func (mock *BackendMock) PutObjectPartCalls() []struct {
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
} {
|
||||
var calls []struct {
|
||||
@@ -1541,6 +1546,7 @@ func (mock *BackendMock) PutObjectPartCalls() []struct {
|
||||
Object string
|
||||
UploadID string
|
||||
Part int
|
||||
Length int64
|
||||
R io.Reader
|
||||
}
|
||||
mock.lockPutObjectPart.RLock()
|
||||
|
||||
Reference in New Issue
Block a user