putObjectMultipartStream - upload a large object using multipart upload and streaming signature for signing payload. Comprehensive put object operation involving multipart uploads. Following code handles these types of readers. - *minio.Object - Any reader which has a method 'ReadAt()'
(ctx context.Context, bucketName, objectName string, reader io.Reader, size int64, opts PutObjectOptions, )
| 42 | // - *minio.Object |
| 43 | // - Any reader which has a method 'ReadAt()' |
| 44 | func (c *Client) putObjectMultipartStream(ctx context.Context, bucketName, objectName string, |
| 45 | reader io.Reader, size int64, opts PutObjectOptions, |
| 46 | ) (info UploadInfo, err error) { |
| 47 | if opts.ConcurrentStreamParts && opts.NumThreads > 1 { |
| 48 | info, err = c.putObjectMultipartStreamParallel(ctx, bucketName, objectName, reader, opts) |
| 49 | } else if !isObject(reader) && isReadAt(reader) && !opts.SendContentMd5 { |
| 50 | // Verify if the reader implements ReadAt and it is not a *minio.Object then we will use parallel uploader. |
| 51 | info, err = c.putObjectMultipartStreamFromReadAt(ctx, bucketName, objectName, reader.(io.ReaderAt), size, opts) |
| 52 | } else { |
| 53 | info, err = c.putObjectMultipartStreamOptionalChecksum(ctx, bucketName, objectName, reader, size, opts) |
| 54 | } |
| 55 | if err != nil && s3utils.IsGoogleEndpoint(*c.endpointURL) { |
| 56 | errResp := ToErrorResponse(err) |
| 57 | // Verify if multipart functionality is not available, if not |
| 58 | // fall back to single PutObject operation. |
| 59 | if errResp.Code == AccessDenied && strings.Contains(errResp.Message, "Access Denied") { |
| 60 | // Verify if size of reader is greater than '5GiB'. |
| 61 | if size > maxSinglePutObjectSize { |
| 62 | return UploadInfo{}, errEntityTooLarge(size, maxSinglePutObjectSize, bucketName, objectName) |
| 63 | } |
| 64 | // Fall back to uploading as single PutObject operation. |
| 65 | return c.putObject(ctx, bucketName, objectName, reader, size, opts) |
| 66 | } |
| 67 | } |
| 68 | return info, err |
| 69 | } |
| 70 | |
| 71 | // uploadedPartRes - the response received from a part upload. |
| 72 | type uploadedPartRes struct { |
no test coverage detected