Merge pull request #870 from harshavardhana/disable-multipart

Disable multipart for donut backend from being used
This commit is contained in:
Harshavardhana 2015-09-24 18:56:53 -07:00
commit e793431852

View File

@ -59,9 +59,9 @@ func (donut API) NewMultipartUpload(bucket, key, contentType string, signature *
return "", probe.NewError(SignatureDoesNotMatch{}) return "", probe.NewError(SignatureDoesNotMatch{})
} }
} }
if len(donut.config.NodeDiskMap) > 0 { // if len(donut.config.NodeDiskMap) > 0 {
return donut.newMultipartUpload(bucket, key, contentType) // return donut.newMultipartUpload(bucket, key, contentType)
} // }
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
return "", probe.NewError(BucketNotFound{Bucket: bucket}) return "", probe.NewError(BucketNotFound{Bucket: bucket})
} }
@ -107,9 +107,12 @@ func (donut API) AbortMultipartUpload(bucket, key, uploadID string, signature *S
return probe.NewError(SignatureDoesNotMatch{}) return probe.NewError(SignatureDoesNotMatch{})
} }
} }
if len(donut.config.NodeDiskMap) > 0 { // TODO: multipart support for donut is broken, since we haven't finalized the format in which
return donut.abortMultipartUpload(bucket, key, uploadID) // it can be stored, disabling this for now until we get the underlying layout stable.
} //
// if len(donut.config.NodeDiskMap) > 0 {
// return donut.abortMultipartUpload(bucket, key, uploadID)
// }
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
return probe.NewError(BucketNotFound{Bucket: bucket}) return probe.NewError(BucketNotFound{Bucket: bucket})
} }
@ -140,6 +143,10 @@ func (donut API) createObjectPart(bucket, key, uploadID string, partID int, cont
if !IsValidObjectName(key) { if !IsValidObjectName(key) {
return "", probe.NewError(ObjectNameInvalid{Object: key}) return "", probe.NewError(ObjectNameInvalid{Object: key})
} }
// TODO: multipart support for donut is broken, since we haven't finalized the format in which
// it can be stored, disabling this for now until we get the underlying layout stable.
//
/*
if len(donut.config.NodeDiskMap) > 0 { if len(donut.config.NodeDiskMap) > 0 {
metadata := make(map[string]string) metadata := make(map[string]string)
if contentType == "" { if contentType == "" {
@ -161,7 +168,7 @@ func (donut API) createObjectPart(bucket, key, uploadID string, partID int, cont
} }
return partMetadata.ETag, nil return partMetadata.ETag, nil
} }
*/
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
return "", probe.NewError(BucketNotFound{Bucket: bucket}) return "", probe.NewError(BucketNotFound{Bucket: bucket})
} }
@ -277,10 +284,13 @@ func (donut API) CompleteMultipartUpload(bucket, key, uploadID string, data io.R
donut.lock.Unlock() donut.lock.Unlock()
return ObjectMetadata{}, probe.NewError(ObjectNameInvalid{Object: key}) return ObjectMetadata{}, probe.NewError(ObjectNameInvalid{Object: key})
} }
if len(donut.config.NodeDiskMap) > 0 { // TODO: multipart support for donut is broken, since we haven't finalized the format in which
donut.lock.Unlock() // it can be stored, disabling this for now until we get the underlying layout stable.
return donut.completeMultipartUpload(bucket, key, uploadID, data, signature) //
} // if len(donut.config.NodeDiskMap) > 0 {
// donut.lock.Unlock()
// return donut.completeMultipartUpload(bucket, key, uploadID, data, signature)
// }
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
donut.lock.Unlock() donut.lock.Unlock()
@ -376,7 +386,7 @@ func (a byKey) Less(i, j int) bool { return a[i].Key < a[j].Key }
// ListMultipartUploads - list incomplete multipart sessions for a given bucket // ListMultipartUploads - list incomplete multipart sessions for a given bucket
func (donut API) ListMultipartUploads(bucket string, resources BucketMultipartResourcesMetadata, signature *Signature) (BucketMultipartResourcesMetadata, *probe.Error) { func (donut API) ListMultipartUploads(bucket string, resources BucketMultipartResourcesMetadata, signature *Signature) (BucketMultipartResourcesMetadata, *probe.Error) {
// TODO handle delimiter // TODO handle delimiter, low priority
donut.lock.Lock() donut.lock.Lock()
defer donut.lock.Unlock() defer donut.lock.Unlock()
@ -394,9 +404,12 @@ func (donut API) ListMultipartUploads(bucket string, resources BucketMultipartRe
return BucketMultipartResourcesMetadata{}, probe.NewError(BucketNameInvalid{Bucket: bucket}) return BucketMultipartResourcesMetadata{}, probe.NewError(BucketNameInvalid{Bucket: bucket})
} }
if len(donut.config.NodeDiskMap) > 0 { // TODO: multipart support for donut is broken, since we haven't finalized the format in which
return donut.listMultipartUploads(bucket, resources) // it can be stored, disabling this for now until we get the underlying layout stable.
} //
// if len(donut.config.NodeDiskMap) > 0 {
// return donut.listMultipartUploads(bucket, resources)
// }
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
return BucketMultipartResourcesMetadata{}, probe.NewError(BucketNotFound{Bucket: bucket}) return BucketMultipartResourcesMetadata{}, probe.NewError(BucketNotFound{Bucket: bucket})
@ -479,9 +492,12 @@ func (donut API) ListObjectParts(bucket, key string, resources ObjectResourcesMe
return ObjectResourcesMetadata{}, probe.NewError(ObjectNameInvalid{Object: key}) return ObjectResourcesMetadata{}, probe.NewError(ObjectNameInvalid{Object: key})
} }
if len(donut.config.NodeDiskMap) > 0 { // TODO: multipart support for donut is broken, since we haven't finalized the format in which
return donut.listObjectParts(bucket, key, resources) // it can be stored, disabling this for now until we get the underlying layout stable.
} //
// if len(donut.config.NodeDiskMap) > 0 {
// return donut.listObjectParts(bucket, key, resources)
// }
if !donut.storedBuckets.Exists(bucket) { if !donut.storedBuckets.Exists(bucket) {
return ObjectResourcesMetadata{}, probe.NewError(BucketNotFound{Bucket: bucket}) return ObjectResourcesMetadata{}, probe.NewError(BucketNotFound{Bucket: bucket})