You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
870 lines
30 KiB
870 lines
30 KiB
9 years ago
|
/*
|
||
|
* Minio Cloud Storage, (C) 2016 Minio, Inc.
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
8 years ago
|
package cmd
|
||
9 years ago
|
|
||
|
import (
|
||
|
"crypto/md5"
|
||
|
"encoding/hex"
|
||
|
"fmt"
|
||
|
"io"
|
||
9 years ago
|
"io/ioutil"
|
||
9 years ago
|
"path"
|
||
9 years ago
|
"strings"
|
||
9 years ago
|
"time"
|
||
9 years ago
|
|
||
|
"github.com/minio/minio/pkg/mimedb"
|
||
9 years ago
|
"github.com/skyrings/skyring-common/tools/uuid"
|
||
9 years ago
|
)
|
||
|
|
||
9 years ago
|
// listMultipartUploads - lists all multipart uploads.
|
||
|
func (xl xlObjects) listMultipartUploads(bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (ListMultipartsInfo, error) {
|
||
|
result := ListMultipartsInfo{
|
||
|
IsTruncated: true,
|
||
|
MaxUploads: maxUploads,
|
||
|
KeyMarker: keyMarker,
|
||
|
Prefix: prefix,
|
||
|
Delimiter: delimiter,
|
||
|
}
|
||
|
|
||
|
recursive := true
|
||
|
if delimiter == slashSeparator {
|
||
|
recursive = false
|
||
|
}
|
||
|
|
||
|
// Not using path.Join() as it strips off the trailing '/'.
|
||
|
multipartPrefixPath := pathJoin(mpartMetaPrefix, bucket, prefix)
|
||
|
if prefix == "" {
|
||
|
// Should have a trailing "/" if prefix is ""
|
||
|
// For ex. multipartPrefixPath should be "multipart/bucket/" if prefix is ""
|
||
|
multipartPrefixPath += slashSeparator
|
||
|
}
|
||
|
multipartMarkerPath := ""
|
||
|
if keyMarker != "" {
|
||
|
multipartMarkerPath = pathJoin(mpartMetaPrefix, bucket, keyMarker)
|
||
|
}
|
||
|
var uploads []uploadMetadata
|
||
|
var err error
|
||
|
var eof bool
|
||
|
// List all upload ids for the keyMarker starting from
|
||
|
// uploadIDMarker first.
|
||
|
if uploadIDMarker != "" {
|
||
|
nsMutex.RLock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, keyMarker))
|
||
9 years ago
|
for _, disk := range xl.getLoadBalancedDisks() {
|
||
9 years ago
|
if disk == nil {
|
||
|
continue
|
||
|
}
|
||
|
uploads, _, err = listMultipartUploadIDs(bucket, keyMarker, uploadIDMarker, maxUploads, disk)
|
||
9 years ago
|
if err == nil {
|
||
|
break
|
||
|
}
|
||
|
if isErrIgnored(err, objMetadataOpIgnoredErrs) {
|
||
9 years ago
|
continue
|
||
|
}
|
||
9 years ago
|
break
|
||
|
}
|
||
9 years ago
|
nsMutex.RUnlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, keyMarker))
|
||
|
if err != nil {
|
||
|
return ListMultipartsInfo{}, err
|
||
|
}
|
||
|
maxUploads = maxUploads - len(uploads)
|
||
|
}
|
||
9 years ago
|
var walkerCh chan treeWalkResult
|
||
|
var walkerDoneCh chan struct{}
|
||
8 years ago
|
heal := false // true only for xl.ListObjectsHeal
|
||
9 years ago
|
// Validate if we need to list further depending on maxUploads.
|
||
|
if maxUploads > 0 {
|
||
8 years ago
|
walkerCh, walkerDoneCh = xl.listPool.Release(listParams{minioMetaBucket, recursive, multipartMarkerPath, multipartPrefixPath, heal})
|
||
9 years ago
|
if walkerCh == nil {
|
||
|
walkerDoneCh = make(chan struct{})
|
||
9 years ago
|
isLeaf := xl.isMultipartUpload
|
||
9 years ago
|
listDir := listDirFactory(isLeaf, xl.getLoadBalancedDisks()...)
|
||
9 years ago
|
walkerCh = startTreeWalk(minioMetaBucket, multipartPrefixPath, multipartMarkerPath, recursive, listDir, isLeaf, walkerDoneCh)
|
||
9 years ago
|
}
|
||
|
// Collect uploads until we have reached maxUploads count to 0.
|
||
|
for maxUploads > 0 {
|
||
9 years ago
|
walkResult, ok := <-walkerCh
|
||
9 years ago
|
if !ok {
|
||
|
// Closed channel.
|
||
|
eof = true
|
||
|
break
|
||
|
}
|
||
|
// For any walk error return right away.
|
||
|
if walkResult.err != nil {
|
||
|
// File not found or Disk not found is a valid case.
|
||
9 years ago
|
if isErrIgnored(walkResult.err, walkResultIgnoredErrs) {
|
||
9 years ago
|
continue
|
||
|
}
|
||
|
return ListMultipartsInfo{}, err
|
||
|
}
|
||
|
entry := strings.TrimPrefix(walkResult.entry, retainSlash(pathJoin(mpartMetaPrefix, bucket)))
|
||
|
// For an entry looking like a directory, store and
|
||
|
// continue the loop not need to fetch uploads.
|
||
|
if strings.HasSuffix(walkResult.entry, slashSeparator) {
|
||
|
uploads = append(uploads, uploadMetadata{
|
||
|
Object: entry,
|
||
|
})
|
||
|
maxUploads--
|
||
|
if maxUploads == 0 {
|
||
9 years ago
|
eof = true
|
||
|
break
|
||
9 years ago
|
}
|
||
|
continue
|
||
|
}
|
||
|
var newUploads []uploadMetadata
|
||
|
var end bool
|
||
|
uploadIDMarker = ""
|
||
|
// For the new object entry we get all its pending uploadIDs.
|
||
|
nsMutex.RLock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, entry))
|
||
9 years ago
|
var disk StorageAPI
|
||
9 years ago
|
for _, disk = range xl.getLoadBalancedDisks() {
|
||
9 years ago
|
if disk == nil {
|
||
|
continue
|
||
|
}
|
||
9 years ago
|
newUploads, end, err = listMultipartUploadIDs(bucket, entry, uploadIDMarker, maxUploads, disk)
|
||
9 years ago
|
if err == nil {
|
||
|
break
|
||
|
}
|
||
|
if isErrIgnored(err, objMetadataOpIgnoredErrs) {
|
||
9 years ago
|
continue
|
||
|
}
|
||
9 years ago
|
break
|
||
|
}
|
||
9 years ago
|
nsMutex.RUnlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, entry))
|
||
|
if err != nil {
|
||
9 years ago
|
if isErrIgnored(err, walkResultIgnoredErrs) {
|
||
9 years ago
|
continue
|
||
|
}
|
||
|
return ListMultipartsInfo{}, err
|
||
|
}
|
||
|
uploads = append(uploads, newUploads...)
|
||
|
maxUploads -= len(newUploads)
|
||
9 years ago
|
if end && walkResult.end {
|
||
9 years ago
|
eof = true
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
// For all received uploads fill in the multiparts result.
|
||
|
for _, upload := range uploads {
|
||
|
var objectName string
|
||
|
var uploadID string
|
||
|
if strings.HasSuffix(upload.Object, slashSeparator) {
|
||
|
// All directory entries are common prefixes.
|
||
|
uploadID = "" // For common prefixes, upload ids are empty.
|
||
|
objectName = upload.Object
|
||
|
result.CommonPrefixes = append(result.CommonPrefixes, objectName)
|
||
|
} else {
|
||
|
uploadID = upload.UploadID
|
||
|
objectName = upload.Object
|
||
|
result.Uploads = append(result.Uploads, upload)
|
||
|
}
|
||
|
result.NextKeyMarker = objectName
|
||
|
result.NextUploadIDMarker = uploadID
|
||
|
}
|
||
9 years ago
|
|
||
|
if !eof {
|
||
|
// Save the go-routine state in the pool so that it can continue from where it left off on
|
||
|
// the next request.
|
||
8 years ago
|
xl.listPool.Set(listParams{bucket, recursive, result.NextKeyMarker, prefix, heal}, walkerCh, walkerDoneCh)
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
result.IsTruncated = !eof
|
||
|
// Result is not truncated, reset the markers.
|
||
|
if !result.IsTruncated {
|
||
|
result.NextKeyMarker = ""
|
||
|
result.NextUploadIDMarker = ""
|
||
|
}
|
||
|
return result, nil
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// ListMultipartUploads - lists all the pending multipart uploads on a
|
||
|
// bucket. Additionally takes 'prefix, keyMarker, uploadIDmarker and a
|
||
|
// delimiter' which allows us to list uploads match a particular
|
||
|
// prefix or lexically starting from 'keyMarker' or delimiting the
|
||
|
// output to get a directory like listing.
|
||
|
//
|
||
|
// Implements S3 compatible ListMultipartUploads API. The resulting
|
||
|
// ListMultipartsInfo structure is unmarshalled directly into XML and
|
||
|
// replied back to the client.
|
||
|
func (xl xlObjects) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (ListMultipartsInfo, error) {
|
||
|
result := ListMultipartsInfo{}
|
||
|
|
||
|
// Verify if bucket is valid.
|
||
9 years ago
|
if !IsValidBucketName(bucket) {
|
||
9 years ago
|
return ListMultipartsInfo{}, BucketNameInvalid{Bucket: bucket}
|
||
9 years ago
|
}
|
||
|
if !xl.isBucketExist(bucket) {
|
||
9 years ago
|
return ListMultipartsInfo{}, BucketNotFound{Bucket: bucket}
|
||
9 years ago
|
}
|
||
9 years ago
|
if !IsValidObjectPrefix(prefix) {
|
||
|
return ListMultipartsInfo{}, ObjectNameInvalid{Bucket: bucket, Object: prefix}
|
||
9 years ago
|
}
|
||
9 years ago
|
// Verify if delimiter is anything other than '/', which we do not support.
|
||
|
if delimiter != "" && delimiter != slashSeparator {
|
||
|
return ListMultipartsInfo{}, UnsupportedDelimiter{
|
||
|
Delimiter: delimiter,
|
||
|
}
|
||
|
}
|
||
|
// Verify if marker has prefix.
|
||
|
if keyMarker != "" && !strings.HasPrefix(keyMarker, prefix) {
|
||
|
return ListMultipartsInfo{}, InvalidMarkerPrefixCombination{
|
||
|
Marker: keyMarker,
|
||
|
Prefix: prefix,
|
||
|
}
|
||
|
}
|
||
|
if uploadIDMarker != "" {
|
||
|
if strings.HasSuffix(keyMarker, slashSeparator) {
|
||
|
return result, InvalidUploadIDKeyCombination{
|
||
|
UploadIDMarker: uploadIDMarker,
|
||
|
KeyMarker: keyMarker,
|
||
|
}
|
||
|
}
|
||
|
id, err := uuid.Parse(uploadIDMarker)
|
||
|
if err != nil {
|
||
|
return result, err
|
||
|
}
|
||
|
if id.IsZero() {
|
||
|
return result, MalformedUploadID{
|
||
|
UploadID: uploadIDMarker,
|
||
|
}
|
||
|
}
|
||
9 years ago
|
}
|
||
9 years ago
|
return xl.listMultipartUploads(bucket, prefix, keyMarker, uploadIDMarker, delimiter, maxUploads)
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// newMultipartUpload - wrapper for initializing a new multipart
|
||
|
// request, returns back a unique upload id.
|
||
|
//
|
||
|
// Internally this function creates 'uploads.json' associated for the
|
||
|
// incoming object at '.minio/multipart/bucket/object/uploads.json' on
|
||
|
// all the disks. `uploads.json` carries metadata regarding on going
|
||
|
// multipart operation on the object.
|
||
|
func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
|
||
9 years ago
|
xlMeta := newXLMetaV1(object, xl.dataBlocks, xl.parityBlocks)
|
||
9 years ago
|
// If not set default to "application/octet-stream"
|
||
|
if meta["content-type"] == "" {
|
||
9 years ago
|
contentType := "application/octet-stream"
|
||
8 years ago
|
if objectExt := path.Ext(object); objectExt != "" {
|
||
9 years ago
|
content, ok := mimedb.DB[strings.ToLower(strings.TrimPrefix(objectExt, "."))]
|
||
|
if ok {
|
||
|
contentType = content.ContentType
|
||
|
}
|
||
|
}
|
||
|
meta["content-type"] = contentType
|
||
9 years ago
|
}
|
||
9 years ago
|
xlMeta.Stat.ModTime = time.Now().UTC()
|
||
9 years ago
|
xlMeta.Meta = meta
|
||
|
|
||
|
// This lock needs to be held for any changes to the directory contents of ".minio/multipart/object/"
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
|
||
|
uploadID = getUUID()
|
||
|
initiated := time.Now().UTC()
|
||
|
// Create 'uploads.json'
|
||
9 years ago
|
if err = xl.writeUploadJSON(bucket, object, uploadID, initiated); err != nil {
|
||
9 years ago
|
return "", err
|
||
|
}
|
||
|
uploadIDPath := path.Join(mpartMetaPrefix, bucket, object, uploadID)
|
||
9 years ago
|
tempUploadIDPath := path.Join(tmpMetaPrefix, uploadID)
|
||
9 years ago
|
// Write updated `xl.json` to all disks.
|
||
9 years ago
|
if err = writeSameXLMetadata(xl.storageDisks, minioMetaBucket, tempUploadIDPath, xlMeta, xl.writeQuorum, xl.readQuorum); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, minioMetaBucket, tempUploadIDPath)
|
||
|
}
|
||
9 years ago
|
rErr := renameObject(xl.storageDisks, minioMetaBucket, tempUploadIDPath, minioMetaBucket, uploadIDPath, xl.writeQuorum)
|
||
9 years ago
|
if rErr == nil {
|
||
|
// Return success.
|
||
|
return uploadID, nil
|
||
9 years ago
|
}
|
||
9 years ago
|
return "", toObjectErr(rErr, minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// NewMultipartUpload - initialize a new multipart upload, returns a
|
||
|
// unique id. The unique id returned here is of UUID form, for each
|
||
|
// subsequent request each UUID is unique.
|
||
|
//
|
||
|
// Implements S3 compatible initiate multipart API.
|
||
9 years ago
|
func (xl xlObjects) NewMultipartUpload(bucket, object string, meta map[string]string) (string, error) {
|
||
9 years ago
|
// Verify if bucket name is valid.
|
||
9 years ago
|
if !IsValidBucketName(bucket) {
|
||
|
return "", BucketNameInvalid{Bucket: bucket}
|
||
|
}
|
||
|
// Verify whether the bucket exists.
|
||
|
if !xl.isBucketExist(bucket) {
|
||
|
return "", BucketNotFound{Bucket: bucket}
|
||
|
}
|
||
9 years ago
|
// Verify if object name is valid.
|
||
9 years ago
|
if !IsValidObjectName(object) {
|
||
|
return "", ObjectNameInvalid{Bucket: bucket, Object: object}
|
||
|
}
|
||
9 years ago
|
// No metadata is set, allocate a new one.
|
||
|
if meta == nil {
|
||
|
meta = make(map[string]string)
|
||
|
}
|
||
|
return xl.newMultipartUpload(bucket, object, meta)
|
||
|
}
|
||
|
|
||
9 years ago
|
// PutObjectPart - reads incoming stream and internally erasure codes
|
||
|
// them. This call is similar to single put operation but it is part
|
||
9 years ago
|
// of the multipart transaction.
|
||
9 years ago
|
//
|
||
|
// Implements S3 compatible Upload Part API.
|
||
|
func (xl xlObjects) PutObjectPart(bucket, object, uploadID string, partID int, size int64, data io.Reader, md5Hex string) (string, error) {
|
||
|
// Verify if bucket is valid.
|
||
|
if !IsValidBucketName(bucket) {
|
||
|
return "", BucketNameInvalid{Bucket: bucket}
|
||
|
}
|
||
|
// Verify whether the bucket exists.
|
||
|
if !xl.isBucketExist(bucket) {
|
||
|
return "", BucketNotFound{Bucket: bucket}
|
||
|
}
|
||
|
if !IsValidObjectName(object) {
|
||
|
return "", ObjectNameInvalid{Bucket: bucket, Object: object}
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
var partsMetadata []xlMetaV1
|
||
|
var errs []error
|
||
|
uploadIDPath := pathJoin(mpartMetaPrefix, bucket, object, uploadID)
|
||
|
nsMutex.RLock(minioMetaBucket, uploadIDPath)
|
||
|
// Validates if upload ID exists.
|
||
9 years ago
|
if !xl.isUploadIDExists(bucket, object, uploadID) {
|
||
9 years ago
|
nsMutex.RUnlock(minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
return "", InvalidUploadID{UploadID: uploadID}
|
||
|
}
|
||
9 years ago
|
// Read metadata associated with the object from all disks.
|
||
9 years ago
|
partsMetadata, errs = readAllXLMetadata(xl.storageDisks, minioMetaBucket,
|
||
|
uploadIDPath)
|
||
9 years ago
|
if !isDiskQuorum(errs, xl.writeQuorum) {
|
||
9 years ago
|
nsMutex.RUnlock(minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
return "", toObjectErr(errXLWriteQuorum, bucket, object)
|
||
|
}
|
||
9 years ago
|
nsMutex.RUnlock(minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
|
||
9 years ago
|
// List all online disks.
|
||
9 years ago
|
onlineDisks, modTime := listOnlineDisks(xl.storageDisks, partsMetadata, errs)
|
||
9 years ago
|
|
||
|
// Pick one from the first valid metadata.
|
||
9 years ago
|
xlMeta := pickValidXLMeta(partsMetadata, modTime)
|
||
|
|
||
|
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks)
|
||
|
partsMetadata = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, partsMetadata)
|
||
9 years ago
|
|
||
9 years ago
|
// Need a unique name for the part being written in minioMetaBucket to
|
||
|
// accommodate concurrent PutObjectPart requests
|
||
9 years ago
|
|
||
9 years ago
|
partSuffix := fmt.Sprintf("part.%d", partID)
|
||
9 years ago
|
tmpSuffix := getUUID()
|
||
9 years ago
|
tmpPartPath := path.Join(tmpMetaPrefix, tmpSuffix)
|
||
9 years ago
|
|
||
|
// Initialize md5 writer.
|
||
|
md5Writer := md5.New()
|
||
|
|
||
9 years ago
|
// Limit the reader to its provided size > 0.
|
||
|
if size > 0 {
|
||
|
// This is done so that we can avoid erroneous clients sending
|
||
|
// more data than the set content size.
|
||
9 years ago
|
data = io.LimitReader(data, size)
|
||
9 years ago
|
} // else we read till EOF.
|
||
|
|
||
9 years ago
|
// Construct a tee reader for md5sum.
|
||
|
teeReader := io.TeeReader(data, md5Writer)
|
||
9 years ago
|
|
||
9 years ago
|
// Erasure code data and write across all disks.
|
||
9 years ago
|
sizeWritten, checkSums, err := erasureCreateFile(onlineDisks, minioMetaBucket, tmpPartPath, teeReader, xlMeta.Erasure.BlockSize, xl.dataBlocks, xl.parityBlocks, bitRotAlgo, xl.writeQuorum)
|
||
9 years ago
|
if err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, bucket, object)
|
||
9 years ago
|
}
|
||
|
// Should return IncompleteBody{} error when reader has fewer bytes
|
||
|
// than specified in request header.
|
||
|
if sizeWritten < size {
|
||
|
return "", IncompleteBody{}
|
||
|
}
|
||
9 years ago
|
|
||
|
// For size == -1, perhaps client is sending in chunked encoding
|
||
|
// set the size as size that was actually written.
|
||
9 years ago
|
if size == -1 {
|
||
9 years ago
|
size = sizeWritten
|
||
9 years ago
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// Validate if payload is valid.
|
||
|
if isSignVerify(data) {
|
||
|
if err = data.(*signVerifyReader).Verify(); err != nil {
|
||
|
// Incoming payload wrong, delete the temporary object.
|
||
|
xl.deleteObject(minioMetaBucket, tmpPartPath)
|
||
|
// Returns md5 mismatch.
|
||
|
return "", toObjectErr(err, bucket, object)
|
||
|
}
|
||
|
}
|
||
|
|
||
9 years ago
|
// Calculate new md5sum.
|
||
9 years ago
|
newMD5Hex := hex.EncodeToString(md5Writer.Sum(nil))
|
||
|
if md5Hex != "" {
|
||
|
if newMD5Hex != md5Hex {
|
||
9 years ago
|
// MD5 mismatch, delete the temporary object.
|
||
|
xl.deleteObject(minioMetaBucket, tmpPartPath)
|
||
|
// Returns md5 mismatch.
|
||
9 years ago
|
return "", BadDigest{md5Hex, newMD5Hex}
|
||
|
}
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
nsMutex.Lock(minioMetaBucket, uploadIDPath)
|
||
|
defer nsMutex.Unlock(minioMetaBucket, uploadIDPath)
|
||
|
|
||
9 years ago
|
// Validate again if upload ID still exists.
|
||
9 years ago
|
if !xl.isUploadIDExists(bucket, object, uploadID) {
|
||
|
return "", InvalidUploadID{UploadID: uploadID}
|
||
|
}
|
||
|
|
||
9 years ago
|
// Rename temporary part file to its final location.
|
||
9 years ago
|
partPath := path.Join(uploadIDPath, partSuffix)
|
||
9 years ago
|
err = renamePart(onlineDisks, minioMetaBucket, tmpPartPath, minioMetaBucket, partPath, xl.writeQuorum)
|
||
9 years ago
|
if err != nil {
|
||
|
return "", toObjectErr(err, minioMetaBucket, partPath)
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// Read metadata again because it might be updated with parallel upload of another part.
|
||
9 years ago
|
partsMetadata, errs = readAllXLMetadata(onlineDisks, minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
if !isDiskQuorum(errs, xl.writeQuorum) {
|
||
9 years ago
|
return "", toObjectErr(errXLWriteQuorum, bucket, object)
|
||
|
}
|
||
|
|
||
9 years ago
|
// Get current highest version based on re-read partsMetadata.
|
||
|
onlineDisks, modTime = listOnlineDisks(onlineDisks, partsMetadata, errs)
|
||
9 years ago
|
|
||
|
// Pick one from the first valid metadata.
|
||
9 years ago
|
xlMeta = pickValidXLMeta(partsMetadata, modTime)
|
||
9 years ago
|
|
||
9 years ago
|
// Once part is successfully committed, proceed with updating XL metadata.
|
||
9 years ago
|
xlMeta.Stat.ModTime = time.Now().UTC()
|
||
9 years ago
|
|
||
9 years ago
|
// Add the current part.
|
||
9 years ago
|
xlMeta.AddObjectPart(partID, partSuffix, newMD5Hex, size)
|
||
|
|
||
9 years ago
|
for index, disk := range onlineDisks {
|
||
|
if disk == nil {
|
||
|
continue
|
||
|
}
|
||
9 years ago
|
partsMetadata[index].Parts = xlMeta.Parts
|
||
9 years ago
|
partsMetadata[index].Erasure.AddCheckSumInfo(checkSumInfo{
|
||
|
Name: partSuffix,
|
||
|
Hash: checkSums[index],
|
||
|
Algorithm: bitRotAlgo,
|
||
|
})
|
||
9 years ago
|
}
|
||
|
|
||
|
// Write all the checksum metadata.
|
||
9 years ago
|
newUUID := getUUID()
|
||
|
tempXLMetaPath := path.Join(tmpMetaPrefix, newUUID)
|
||
9 years ago
|
|
||
9 years ago
|
// Writes a unique `xl.json` each disk carrying new checksum related information.
|
||
|
if err = writeUniqueXLMetadata(onlineDisks, minioMetaBucket, tempXLMetaPath, partsMetadata, xl.writeQuorum); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, minioMetaBucket, tempXLMetaPath)
|
||
9 years ago
|
}
|
||
9 years ago
|
rErr := commitXLMetadata(onlineDisks, tempXLMetaPath, uploadIDPath, xl.writeQuorum)
|
||
9 years ago
|
if rErr != nil {
|
||
|
return "", toObjectErr(rErr, minioMetaBucket, uploadIDPath)
|
||
|
}
|
||
|
|
||
|
// Return success.
|
||
9 years ago
|
return newMD5Hex, nil
|
||
|
}
|
||
|
|
||
9 years ago
|
// listObjectParts - wrapper reading `xl.json` for a given object and
|
||
|
// uploadID. Lists all the parts captured inside `xl.json` content.
|
||
|
func (xl xlObjects) listObjectParts(bucket, object, uploadID string, partNumberMarker, maxParts int) (ListPartsInfo, error) {
|
||
9 years ago
|
result := ListPartsInfo{}
|
||
|
|
||
|
uploadIDPath := path.Join(mpartMetaPrefix, bucket, object, uploadID)
|
||
9 years ago
|
|
||
9 years ago
|
xlMeta, err := xl.readXLMetadata(minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
if err != nil {
|
||
|
return ListPartsInfo{}, toObjectErr(err, minioMetaBucket, uploadIDPath)
|
||
|
}
|
||
9 years ago
|
|
||
|
// Populate the result stub.
|
||
|
result.Bucket = bucket
|
||
|
result.Object = object
|
||
|
result.UploadID = uploadID
|
||
|
result.MaxParts = maxParts
|
||
|
|
||
|
// For empty number of parts or maxParts as zero, return right here.
|
||
|
if len(xlMeta.Parts) == 0 || maxParts == 0 {
|
||
|
return result, nil
|
||
|
}
|
||
|
|
||
|
// Limit output to maxPartsList.
|
||
|
if maxParts > maxPartsList {
|
||
|
maxParts = maxPartsList
|
||
|
}
|
||
|
|
||
9 years ago
|
// Only parts with higher part numbers will be listed.
|
||
9 years ago
|
partIdx := xlMeta.ObjectPartIndex(partNumberMarker)
|
||
9 years ago
|
parts := xlMeta.Parts
|
||
|
if partIdx != -1 {
|
||
|
parts = xlMeta.Parts[partIdx+1:]
|
||
|
}
|
||
9 years ago
|
count := maxParts
|
||
9 years ago
|
for _, part := range parts {
|
||
9 years ago
|
var fi FileInfo
|
||
9 years ago
|
fi, err = xl.statPart(bucket, object, uploadID, part.Name)
|
||
9 years ago
|
if err != nil {
|
||
9 years ago
|
return ListPartsInfo{}, toObjectErr(err, minioMetaBucket, path.Join(uploadID, part.Name))
|
||
9 years ago
|
}
|
||
|
result.Parts = append(result.Parts, partInfo{
|
||
9 years ago
|
PartNumber: part.Number,
|
||
9 years ago
|
ETag: part.ETag,
|
||
|
LastModified: fi.ModTime,
|
||
9 years ago
|
Size: part.Size,
|
||
9 years ago
|
})
|
||
|
count--
|
||
|
if count == 0 {
|
||
|
break
|
||
|
}
|
||
|
}
|
||
|
// If listed entries are more than maxParts, we set IsTruncated as true.
|
||
|
if len(parts) > len(result.Parts) {
|
||
|
result.IsTruncated = true
|
||
|
// Make sure to fill next part number marker if IsTruncated is
|
||
|
// true for subsequent listing.
|
||
|
nextPartNumberMarker := result.Parts[len(result.Parts)-1].PartNumber
|
||
|
result.NextPartNumberMarker = nextPartNumberMarker
|
||
|
}
|
||
|
return result, nil
|
||
|
}
|
||
|
|
||
9 years ago
|
// ListObjectParts - lists all previously uploaded parts for a given
|
||
|
// object and uploadID. Takes additional input of part-number-marker
|
||
|
// to indicate where the listing should begin from.
|
||
|
//
|
||
|
// Implements S3 compatible ListObjectParts API. The resulting
|
||
|
// ListPartsInfo structure is unmarshalled directly into XML and
|
||
|
// replied back to the client.
|
||
9 years ago
|
func (xl xlObjects) ListObjectParts(bucket, object, uploadID string, partNumberMarker, maxParts int) (ListPartsInfo, error) {
|
||
9 years ago
|
// Verify if bucket is valid.
|
||
|
if !IsValidBucketName(bucket) {
|
||
|
return ListPartsInfo{}, BucketNameInvalid{Bucket: bucket}
|
||
|
}
|
||
|
// Verify whether the bucket exists.
|
||
|
if !xl.isBucketExist(bucket) {
|
||
|
return ListPartsInfo{}, BucketNotFound{Bucket: bucket}
|
||
|
}
|
||
|
if !IsValidObjectName(object) {
|
||
|
return ListPartsInfo{}, ObjectNameInvalid{Bucket: bucket, Object: object}
|
||
|
}
|
||
|
// Hold lock so that there is no competing abort-multipart-upload or complete-multipart-upload.
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
|
||
|
if !xl.isUploadIDExists(bucket, object, uploadID) {
|
||
|
return ListPartsInfo{}, InvalidUploadID{UploadID: uploadID}
|
||
|
}
|
||
|
result, err := xl.listObjectParts(bucket, object, uploadID, partNumberMarker, maxParts)
|
||
|
return result, err
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// CompleteMultipartUpload - completes an ongoing multipart
|
||
|
// transaction after receiving all the parts indicated by the client.
|
||
|
// Returns an md5sum calculated by concatenating all the individual
|
||
|
// md5sums of all the parts.
|
||
|
//
|
||
|
// Implements S3 compatible Complete multipart API.
|
||
9 years ago
|
func (xl xlObjects) CompleteMultipartUpload(bucket string, object string, uploadID string, parts []completePart) (string, error) {
|
||
|
// Verify if bucket is valid.
|
||
|
if !IsValidBucketName(bucket) {
|
||
|
return "", BucketNameInvalid{Bucket: bucket}
|
||
|
}
|
||
|
// Verify whether the bucket exists.
|
||
|
if !xl.isBucketExist(bucket) {
|
||
|
return "", BucketNotFound{Bucket: bucket}
|
||
|
}
|
||
|
if !IsValidObjectName(object) {
|
||
|
return "", ObjectNameInvalid{
|
||
|
Bucket: bucket,
|
||
|
Object: object,
|
||
|
}
|
||
|
}
|
||
|
// Hold lock so that
|
||
|
// 1) no one aborts this multipart upload
|
||
|
// 2) no one does a parallel complete-multipart-upload on this multipart upload
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
|
||
9 years ago
|
if !xl.isUploadIDExists(bucket, object, uploadID) {
|
||
|
return "", InvalidUploadID{UploadID: uploadID}
|
||
|
}
|
||
9 years ago
|
// Calculate s3 compatible md5sum for complete multipart.
|
||
|
s3MD5, err := completeMultipartMD5(parts...)
|
||
|
if err != nil {
|
||
|
return "", err
|
||
|
}
|
||
|
|
||
|
uploadIDPath := pathJoin(mpartMetaPrefix, bucket, object, uploadID)
|
||
9 years ago
|
|
||
9 years ago
|
// Read metadata associated with the object from all disks.
|
||
9 years ago
|
partsMetadata, errs := readAllXLMetadata(xl.storageDisks, minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
// Do we have writeQuorum?.
|
||
9 years ago
|
if !isDiskQuorum(errs, xl.writeQuorum) {
|
||
9 years ago
|
return "", toObjectErr(errXLWriteQuorum, bucket, object)
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
onlineDisks, modTime := listOnlineDisks(xl.storageDisks, partsMetadata, errs)
|
||
9 years ago
|
|
||
9 years ago
|
// Calculate full object size.
|
||
9 years ago
|
var objectSize int64
|
||
9 years ago
|
|
||
9 years ago
|
// Pick one from the first valid metadata.
|
||
9 years ago
|
xlMeta := pickValidXLMeta(partsMetadata, modTime)
|
||
9 years ago
|
|
||
9 years ago
|
// Order online disks in accordance with distribution order.
|
||
|
onlineDisks = getOrderedDisks(xlMeta.Erasure.Distribution, onlineDisks)
|
||
|
|
||
|
// Order parts metadata in accordance with distribution order.
|
||
|
partsMetadata = getOrderedPartsMetadata(xlMeta.Erasure.Distribution, partsMetadata)
|
||
|
|
||
9 years ago
|
// Save current xl meta for validation.
|
||
|
var currentXLMeta = xlMeta
|
||
|
|
||
|
// Allocate parts similar to incoming slice.
|
||
|
xlMeta.Parts = make([]objectPartInfo, len(parts))
|
||
|
|
||
9 years ago
|
// Validate each part and then commit to disk.
|
||
9 years ago
|
for i, part := range parts {
|
||
9 years ago
|
partIdx := currentXLMeta.ObjectPartIndex(part.PartNumber)
|
||
9 years ago
|
// All parts should have same part number.
|
||
9 years ago
|
if partIdx == -1 {
|
||
9 years ago
|
return "", InvalidPart{}
|
||
|
}
|
||
9 years ago
|
|
||
|
// All parts should have same ETag as previously generated.
|
||
9 years ago
|
if currentXLMeta.Parts[partIdx].ETag != part.ETag {
|
||
|
return "", BadDigest{}
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// All parts except the last part has to be atleast 5MB.
|
||
9 years ago
|
if (i < len(parts)-1) && !isMinAllowedPartSize(currentXLMeta.Parts[partIdx].Size) {
|
||
9 years ago
|
return "", PartTooSmall{
|
||
|
PartNumber: part.PartNumber,
|
||
|
PartSize: currentXLMeta.Parts[partIdx].Size,
|
||
|
PartETag: part.ETag,
|
||
|
}
|
||
9 years ago
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// Last part could have been uploaded as 0bytes, do not need
|
||
|
// to save it in final `xl.json`.
|
||
|
if (i == len(parts)-1) && currentXLMeta.Parts[partIdx].Size == 0 {
|
||
|
xlMeta.Parts = xlMeta.Parts[:i] // Skip the part.
|
||
|
continue
|
||
|
}
|
||
|
|
||
9 years ago
|
// Save for total object size.
|
||
|
objectSize += currentXLMeta.Parts[partIdx].Size
|
||
|
|
||
|
// Add incoming parts.
|
||
|
xlMeta.Parts[i] = objectPartInfo{
|
||
|
Number: part.PartNumber,
|
||
|
ETag: part.ETag,
|
||
|
Size: currentXLMeta.Parts[partIdx].Size,
|
||
9 years ago
|
Name: fmt.Sprintf("part.%d", part.PartNumber),
|
||
9 years ago
|
}
|
||
9 years ago
|
}
|
||
|
|
||
|
// Check if an object is present as one of the parent dir.
|
||
|
if xl.parentDirIsObject(bucket, path.Dir(object)) {
|
||
|
return "", toObjectErr(errFileAccessDenied, bucket, object)
|
||
|
}
|
||
|
|
||
|
// Save the final object size and modtime.
|
||
|
xlMeta.Stat.Size = objectSize
|
||
|
xlMeta.Stat.ModTime = time.Now().UTC()
|
||
|
|
||
|
// Save successfully calculated md5sum.
|
||
|
xlMeta.Meta["md5Sum"] = s3MD5
|
||
9 years ago
|
uploadIDPath = path.Join(mpartMetaPrefix, bucket, object, uploadID)
|
||
9 years ago
|
tempUploadIDPath := path.Join(tmpMetaPrefix, uploadID)
|
||
9 years ago
|
|
||
|
// Update all xl metadata, make sure to not modify fields like
|
||
|
// checksum which are different on each disks.
|
||
|
for index := range partsMetadata {
|
||
|
partsMetadata[index].Stat = xlMeta.Stat
|
||
|
partsMetadata[index].Meta = xlMeta.Meta
|
||
|
partsMetadata[index].Parts = xlMeta.Parts
|
||
|
}
|
||
9 years ago
|
|
||
9 years ago
|
// Write unique `xl.json` for each disk.
|
||
9 years ago
|
if err = writeUniqueXLMetadata(onlineDisks, minioMetaBucket, tempUploadIDPath, partsMetadata, xl.writeQuorum); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, minioMetaBucket, tempUploadIDPath)
|
||
|
}
|
||
9 years ago
|
rErr := commitXLMetadata(onlineDisks, tempUploadIDPath, uploadIDPath, xl.writeQuorum)
|
||
9 years ago
|
if rErr != nil {
|
||
|
return "", toObjectErr(rErr, minioMetaBucket, uploadIDPath)
|
||
9 years ago
|
}
|
||
9 years ago
|
// Hold write lock on the destination before rename.
|
||
9 years ago
|
nsMutex.Lock(bucket, object)
|
||
9 years ago
|
defer func() {
|
||
|
// A new complete multipart upload invalidates any
|
||
|
// previously cached object in memory.
|
||
|
xl.objCache.Delete(path.Join(bucket, object))
|
||
|
|
||
|
// This lock also protects the cache namespace.
|
||
|
nsMutex.Unlock(bucket, object)
|
||
|
|
||
8 years ago
|
// Prefetch the object from disk by triggering a fake GetObject call
|
||
9 years ago
|
// Unlike a regular single PutObject, multipart PutObject is comes in
|
||
|
// stages and it is harder to cache.
|
||
|
go xl.GetObject(bucket, object, 0, objectSize, ioutil.Discard)
|
||
|
}()
|
||
9 years ago
|
|
||
9 years ago
|
// Rename if an object already exists to temporary location.
|
||
|
uniqueID := getUUID()
|
||
9 years ago
|
if xl.isObject(bucket, object) {
|
||
9 years ago
|
// NOTE: Do not use online disks slice here.
|
||
|
// The reason is that existing object should be purged
|
||
|
// regardless of `xl.json` status and rolled back in case of errors.
|
||
9 years ago
|
err = renameObject(xl.storageDisks, bucket, object, minioMetaBucket, path.Join(tmpMetaPrefix, uniqueID), xl.writeQuorum)
|
||
9 years ago
|
if err != nil {
|
||
|
return "", toObjectErr(err, bucket, object)
|
||
|
}
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
// Remove parts that weren't present in CompleteMultipartUpload request.
|
||
9 years ago
|
for _, curpart := range currentXLMeta.Parts {
|
||
|
if xlMeta.ObjectPartIndex(curpart.Number) == -1 {
|
||
|
// Delete the missing part files. e.g,
|
||
|
// Request 1: NewMultipart
|
||
|
// Request 2: PutObjectPart 1
|
||
|
// Request 3: PutObjectPart 2
|
||
|
// Request 4: CompleteMultipartUpload --part 2
|
||
|
// N.B. 1st part is not present. This part should be removed from the storage.
|
||
|
xl.removeObjectPart(bucket, object, uploadID, curpart.Name)
|
||
|
}
|
||
|
}
|
||
|
|
||
9 years ago
|
// Rename the multipart object to final location.
|
||
9 years ago
|
if err = renameObject(onlineDisks, minioMetaBucket, uploadIDPath, bucket, object, xl.writeQuorum); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, bucket, object)
|
||
|
}
|
||
|
|
||
9 years ago
|
// Delete the previously successfully renamed object.
|
||
|
xl.deleteObject(minioMetaBucket, path.Join(tmpMetaPrefix, uniqueID))
|
||
|
|
||
9 years ago
|
// Hold the lock so that two parallel complete-multipart-uploads do not
|
||
9 years ago
|
// leave a stale uploads.json behind.
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
|
||
|
// Validate if there are other incomplete upload-id's present for
|
||
|
// the object, if yes do not attempt to delete 'uploads.json'.
|
||
9 years ago
|
uploadsJSON, err := xl.readUploadsJSON(bucket, object)
|
||
9 years ago
|
if err != nil {
|
||
|
return "", toObjectErr(err, minioMetaBucket, object)
|
||
9 years ago
|
}
|
||
9 years ago
|
// If we have successfully read `uploads.json`, then we proceed to
|
||
|
// purge or update `uploads.json`.
|
||
|
uploadIDIdx := uploadsJSON.Index(uploadID)
|
||
|
if uploadIDIdx != -1 {
|
||
|
uploadsJSON.Uploads = append(uploadsJSON.Uploads[:uploadIDIdx], uploadsJSON.Uploads[uploadIDIdx+1:]...)
|
||
|
}
|
||
|
if len(uploadsJSON.Uploads) > 0 {
|
||
9 years ago
|
if err = xl.updateUploadsJSON(bucket, object, uploadsJSON); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||
|
}
|
||
|
// Return success.
|
||
|
return s3MD5, nil
|
||
|
} // No more pending uploads for the object, proceed to delete
|
||
|
// object completely from '.minio/multipart'.
|
||
9 years ago
|
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
||
9 years ago
|
return "", toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||
|
}
|
||
|
|
||
|
// Return md5sum.
|
||
|
return s3MD5, nil
|
||
|
}
|
||
|
|
||
9 years ago
|
// abortMultipartUpload - wrapper for purging an ongoing multipart
|
||
|
// transaction, deletes uploadID entry from `uploads.json` and purges
|
||
|
// the directory at '.minio/multipart/bucket/object/uploadID' holding
|
||
|
// all the upload parts.
|
||
|
func (xl xlObjects) abortMultipartUpload(bucket, object, uploadID string) (err error) {
|
||
|
// Cleanup all uploaded parts.
|
||
|
if err = cleanupUploadedParts(bucket, object, uploadID, xl.storageDisks...); err != nil {
|
||
|
return toObjectErr(err, bucket, object)
|
||
|
}
|
||
|
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object))
|
||
|
// Validate if there are other incomplete upload-id's present for
|
||
|
// the object, if yes do not attempt to delete 'uploads.json'.
|
||
9 years ago
|
uploadsJSON, err := xl.readUploadsJSON(bucket, object)
|
||
9 years ago
|
if err != nil {
|
||
|
return toObjectErr(err, bucket, object)
|
||
|
}
|
||
|
uploadIDIdx := uploadsJSON.Index(uploadID)
|
||
|
if uploadIDIdx != -1 {
|
||
|
uploadsJSON.Uploads = append(uploadsJSON.Uploads[:uploadIDIdx], uploadsJSON.Uploads[uploadIDIdx+1:]...)
|
||
|
}
|
||
|
if len(uploadsJSON.Uploads) > 0 {
|
||
|
// There are pending uploads for the same object, preserve
|
||
|
// them update 'uploads.json' in-place.
|
||
9 years ago
|
err = xl.updateUploadsJSON(bucket, object, uploadsJSON)
|
||
9 years ago
|
if err != nil {
|
||
|
return toObjectErr(err, bucket, object)
|
||
|
}
|
||
|
return nil
|
||
|
} // No more pending uploads for the object, we purge the entire
|
||
|
// entry at '.minio/multipart/bucket/object'.
|
||
|
if err = xl.deleteObject(minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object)); err != nil {
|
||
|
return toObjectErr(err, minioMetaBucket, path.Join(mpartMetaPrefix, bucket, object))
|
||
|
}
|
||
|
|
||
|
// Successfully purged.
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// AbortMultipartUpload - aborts an ongoing multipart operation
|
||
|
// signified by the input uploadID. This is an atomic operation
|
||
|
// doesn't require clients to initiate multiple such requests.
|
||
|
//
|
||
|
// All parts are purged from all disks and reference to the uploadID
|
||
|
// would be removed from the system, rollback is not possible on this
|
||
|
// operation.
|
||
|
//
|
||
|
// Implements S3 compatible Abort multipart API, slight difference is
|
||
|
// that this is an atomic idempotent operation. Subsequent calls have
|
||
|
// no affect and further requests to the same uploadID would not be honored.
|
||
|
func (xl xlObjects) AbortMultipartUpload(bucket, object, uploadID string) error {
|
||
9 years ago
|
// Verify if bucket is valid.
|
||
|
if !IsValidBucketName(bucket) {
|
||
|
return BucketNameInvalid{Bucket: bucket}
|
||
|
}
|
||
|
if !xl.isBucketExist(bucket) {
|
||
|
return BucketNotFound{Bucket: bucket}
|
||
|
}
|
||
|
if !IsValidObjectName(object) {
|
||
|
return ObjectNameInvalid{Bucket: bucket, Object: object}
|
||
|
}
|
||
|
|
||
|
// Hold lock so that there is no competing complete-multipart-upload or put-object-part.
|
||
|
nsMutex.Lock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
defer nsMutex.Unlock(minioMetaBucket, pathJoin(mpartMetaPrefix, bucket, object, uploadID))
|
||
|
|
||
9 years ago
|
if !xl.isUploadIDExists(bucket, object, uploadID) {
|
||
|
return InvalidUploadID{UploadID: uploadID}
|
||
|
}
|
||
9 years ago
|
err := xl.abortMultipartUpload(bucket, object, uploadID)
|
||
|
return err
|
||
9 years ago
|
}
|