MCPcopy
hub / github.com/minio/minio-go / putObjectMultipart

Method putObjectMultipart

api-put-object-multipart.go:39–57  ·  view source on GitHub ↗
(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64,
	opts PutObjectOptions,
)

Source from the content-addressed store, hash-verified

37)
38
39func (c *Client) putObjectMultipart(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64,
40 opts PutObjectOptions,
41) (info UploadInfo, err error) {
42 info, err = c.putObjectMultipartNoStream(ctx, bucketName, objectName, reader, opts)
43 if err != nil {
44 errResp := ToErrorResponse(err)
45 // Verify if multipart functionality is not available, if not
46 // fall back to single PutObject operation.
47 if errResp.Code == AccessDenied && strings.Contains(errResp.Message, "Access Denied") {
48 // Verify if size of reader is greater than '5GiB'.
49 if size > maxSinglePutObjectSize {
50 return UploadInfo{}, errEntityTooLarge(size, maxSinglePutObjectSize, bucketName, objectName)
51 }
52 // Fall back to uploading as single PutObject operation.
53 return c.putObject(ctx, bucketName, objectName, reader, size, opts)
54 }
55 }
56 return info, err
57}
58
59func (c *Client) putObjectMultipartNoStream(ctx context.Context, bucketName, objectName string, reader io.Reader, opts PutObjectOptions) (info UploadInfo, err error) {
60 // Input validation.

Callers 1

PutObjectMethod · 0.95

Calls 5

putObjectMethod · 0.95
ToErrorResponseFunction · 0.85
errEntityTooLargeFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected