listObjectParts list all object parts recursively. lint:ignore U1000 Keep this around
(ctx context.Context, bucketName, objectName, uploadID string)
| 1037 | // |
| 1038 | //lint:ignore U1000 Keep this around |
| 1039 | func (c *Client) listObjectParts(ctx context.Context, bucketName, objectName, uploadID string) (partsInfo map[int]ObjectPart, err error) { |
| 1040 | // Part number marker for the next batch of request. |
| 1041 | var nextPartNumberMarker int |
| 1042 | partsInfo = make(map[int]ObjectPart) |
| 1043 | for { |
| 1044 | // Get list of uploaded parts a maximum of 1000 per request. |
| 1045 | listObjPartsResult, err := c.listObjectPartsQuery(ctx, bucketName, objectName, uploadID, nextPartNumberMarker, 1000) |
| 1046 | if err != nil { |
| 1047 | return nil, err |
| 1048 | } |
| 1049 | // Append to parts info. |
| 1050 | for _, part := range listObjPartsResult.ObjectParts { |
| 1051 | // Trim off the odd double quotes from ETag in the beginning and end. |
| 1052 | part.ETag = trimEtag(part.ETag) |
| 1053 | partsInfo[part.PartNumber] = part |
| 1054 | } |
| 1055 | // Keep part number marker, for the next iteration. |
| 1056 | nextPartNumberMarker = listObjPartsResult.NextPartNumberMarker |
| 1057 | // Listing ends result is not truncated, return right here. |
| 1058 | if !listObjPartsResult.IsTruncated { |
| 1059 | break |
| 1060 | } |
| 1061 | } |
| 1062 | |
| 1063 | // Return all the parts. |
| 1064 | return partsInfo, nil |
| 1065 | } |
| 1066 | |
| 1067 | // findUploadIDs lists all incomplete uploads and find the uploadIDs of the matching object name. |
| 1068 | func (c *Client) findUploadIDs(ctx context.Context, bucketName, objectName string) ([]string, error) { |