Skip to content

Commit

Permalink
Update minio.Core API
Browse files Browse the repository at this point in the history
These breaking changes are added:

- Add custom headers parameter for PutObjectPart

- Expose upload info in CompleteMultipartUpload
  • Loading branch information
donatello committed Jan 27, 2023
1 parent f5f1604 commit 90e7195
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions core.go
Expand Up @@ -87,7 +87,10 @@ func (c Core) ListMultipartUploads(ctx context.Context, bucket, prefix, keyMarke
}

// PutObjectPart - Upload an object part.
func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int, data io.Reader, size int64, md5Base64, sha256Hex string, sse encrypt.ServerSide) (ObjectPart, error) {
func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string,
partID int, data io.Reader, size int64, md5Base64, sha256Hex string,
sse encrypt.ServerSide, customHeader http.Header,
) (ObjectPart, error) {
p := uploadPartParams{
bucketName: bucket,
objectName: object,
Expand All @@ -99,6 +102,7 @@ func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string
size: size,
sse: sse,
streamSha256: true,
customHeader: customHeader,
}
return c.uploadPart(ctx, p)
}
Expand All @@ -109,11 +113,11 @@ func (c Core) ListObjectParts(ctx context.Context, bucket, object, uploadID stri
}

// CompleteMultipartUpload - Concatenate uploaded parts and commit to an object.
func (c Core) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, parts []CompletePart, opts PutObjectOptions) (string, error) {
func (c Core) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, parts []CompletePart, opts PutObjectOptions) (UploadInfo, error) {
res, err := c.completeMultipartUpload(ctx, bucket, object, uploadID, completeMultipartUpload{
Parts: parts,
}, opts)
return res.ETag, err
return res, err
}

// AbortMultipartUpload - Abort an incomplete upload.
Expand Down
2 changes: 1 addition & 1 deletion core_test.go
Expand Up @@ -875,7 +875,7 @@ func TestCoreMultipartUpload(t *testing.T) {
partID++
data := bytes.NewReader(partBuf[:n])
dataLen := int64(len(partBuf[:n]))
objectPart, err := core.PutObjectPart(context.Background(), bucketName, objectName, uploadID, partID, data, dataLen, "", "", encrypt.NewSSE())
objectPart, err := core.PutObjectPart(context.Background(), bucketName, objectName, uploadID, partID, data, dataLen, "", "", encrypt.NewSSE(), nil)
if err != nil {
t.Fatal("Error:", err, bucketName, objectName)
}
Expand Down

0 comments on commit 90e7195

Please sign in to comment.