Minor changes to minio-go library, update it here - also update version.go

This commit is contained in:
Harshavardhana
2015-06-10 21:16:31 -07:00
parent 6b05292865
commit 7ae885fdcd
4 changed files with 36 additions and 18 deletions
+1 -1
View File
@@ -28,7 +28,7 @@
},
{
"ImportPath": "github.com/minio/minio-go",
"Rev": "77eadd00bfa2e6b7ae39f74a4f8b698df5ec9672"
"Rev": "a41bd929a5c2451970eb6fa731156d9481f77b1c"
},
{
"ImportPath": "github.com/minio/minio/pkg/iodine",
+12 -13
View File
@@ -60,8 +60,8 @@ type ObjectAPI interface {
StatObject(bucket, object string) (ObjectStat, error)
RemoveObject(bucket, object string) error
// Drop all incomplete uploads for a given prefix
DropIncompleteUploads(bucket, prefix string) <-chan error
// Drop all incomplete uploads for a given object
DropIncompleteUploads(bucket, object string) <-chan error
}
// BucketStatCh - bucket metadata over read channel
@@ -365,15 +365,15 @@ type multiPartUploadCh struct {
Err error
}
func (a api) listMultipartUploadsRecursive(bucket, prefix string) <-chan multiPartUploadCh {
func (a api) listMultipartUploadsRecursive(bucket, object string) <-chan multiPartUploadCh {
ch := make(chan multiPartUploadCh)
go a.listMultipartUploadsRecursiveInRoutine(bucket, prefix, ch)
go a.listMultipartUploadsRecursiveInRoutine(bucket, object, ch)
return ch
}
func (a api) listMultipartUploadsRecursiveInRoutine(bucket, prefix string, ch chan multiPartUploadCh) {
func (a api) listMultipartUploadsRecursiveInRoutine(bucket, object string, ch chan multiPartUploadCh) {
defer close(ch)
listMultipartUploadsResult, err := a.listMultipartUploads(bucket, "", "", prefix, "", 1000)
listMultipartUploadsResult, err := a.listMultipartUploads(bucket, "", "", object, "", 1000)
if err != nil {
ch <- multiPartUploadCh{
Metadata: upload{},
@@ -392,7 +392,7 @@ func (a api) listMultipartUploadsRecursiveInRoutine(bucket, prefix string, ch ch
break
}
listMultipartUploadsResult, err = a.listMultipartUploads(bucket,
listMultipartUploadsResult.NextKeyMarker, listMultipartUploadsResult.NextUploadIDMarker, prefix, "", 1000)
listMultipartUploadsResult.NextKeyMarker, listMultipartUploadsResult.NextUploadIDMarker, object, "", 1000)
if err != nil {
ch <- multiPartUploadCh{
Metadata: upload{},
@@ -689,13 +689,13 @@ func (a api) ListBuckets() <-chan BucketStatCh {
return ch
}
func (a api) dropIncompleteUploadsInRoutine(bucket, prefix string, errorCh chan error) {
func (a api) dropIncompleteUploadsInRoutine(bucket, object string, errorCh chan error) {
defer close(errorCh)
if err := invalidBucketToError(bucket); err != nil {
errorCh <- err
return
}
listMultipartUploadsResult, err := a.listMultipartUploads(bucket, "", "", prefix, "", 1000)
listMultipartUploadsResult, err := a.listMultipartUploads(bucket, "", "", object, "", 1000)
if err != nil {
errorCh <- err
return
@@ -712,7 +712,7 @@ func (a api) dropIncompleteUploadsInRoutine(bucket, prefix string, errorCh chan
break
}
listMultipartUploadsResult, err = a.listMultipartUploads(bucket,
listMultipartUploadsResult.NextKeyMarker, listMultipartUploadsResult.NextUploadIDMarker, prefix, "", 1000)
listMultipartUploadsResult.NextKeyMarker, listMultipartUploadsResult.NextUploadIDMarker, object, "", 1000)
if err != nil {
errorCh <- err
return
@@ -734,12 +734,11 @@ func (a api) dropIncompleteUploadsInRoutine(bucket, prefix string, errorCh chan
// NOTE:
// These set of calls require explicit authentication, no anonymous
// requests are allowed for multipart API
//
// DropIncompleteUploads - abort a specific in progress active multipart upload
func (a api) DropIncompleteUploads(bucket, prefix string) <-chan error {
func (a api) DropIncompleteUploads(bucket, object string) <-chan error {
errorCh := make(chan error)
go a.dropIncompleteUploadsInRoutine(bucket, prefix, errorCh)
go a.dropIncompleteUploadsInRoutine(bucket, object, errorCh)
return errorCh
}
+22 -3
View File
@@ -34,20 +34,20 @@ func (h bucketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case r.Method == "GET":
switch {
case r.URL.Path == "/":
response := []byte("<ListAllMyBucketsResult xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><Buckets><Bucket><Name>bucket</Name><CreationDate>2015-05-20T23:05:09.230Z</CreationDate></Bucket></Buckets><Owner><ID>minio</ID><DisplayName>minio</DisplayName></Owner></ListAllMyBucketsResult>")
response := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ListAllMyBucketsResult xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><Buckets><Bucket><Name>bucket</Name><CreationDate>2015-05-20T23:05:09.230Z</CreationDate></Bucket></Buckets><Owner><ID>minio</ID><DisplayName>minio</DisplayName></Owner></ListAllMyBucketsResult>")
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
w.Write(response)
case r.URL.Path == "/bucket":
_, ok := r.URL.Query()["acl"]
if ok {
response := []byte("<AccessControlPolicy><Owner><ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID><DisplayName>CustomersName@amazon.com</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID><DisplayName>CustomersName@amazon.com</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>")
response := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><AccessControlPolicy><Owner><ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID><DisplayName>CustomersName@amazon.com</DisplayName></Owner><AccessControlList><Grant><Grantee xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:type=\"CanonicalUser\"><ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID><DisplayName>CustomersName@amazon.com</DisplayName></Grantee><Permission>FULL_CONTROL</Permission></Grant></AccessControlList></AccessControlPolicy>")
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
w.Write(response)
return
}
fallthrough
case r.URL.Path == "/bucket":
response := []byte("<ListBucketResult xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><Contents><ETag>259d04a13802ae09c7e41be50ccc6baa</ETag><Key>object</Key><LastModified>2015-05-21T18:24:21.097Z</LastModified><Size>22061</Size><Owner><ID>minio</ID><DisplayName>minio</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Delimiter></Delimiter><EncodingType></EncodingType><IsTruncated>false</IsTruncated><Marker></Marker><MaxKeys>1000</MaxKeys><Name>testbucket</Name><NextMarker></NextMarker><Prefix></Prefix></ListBucketResult>")
response := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ListBucketResult xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><Contents><ETag>259d04a13802ae09c7e41be50ccc6baa</ETag><Key>object</Key><LastModified>2015-05-21T18:24:21.097Z</LastModified><Size>22061</Size><Owner><ID>minio</ID><DisplayName>minio</DisplayName></Owner><StorageClass>STANDARD</StorageClass></Contents><Delimiter></Delimiter><EncodingType></EncodingType><IsTruncated>false</IsTruncated><Marker></Marker><MaxKeys>1000</MaxKeys><Name>testbucket</Name><NextMarker></NextMarker><Prefix></Prefix></ListBucketResult>")
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
w.Write(response)
}
@@ -118,7 +118,26 @@ func (h objectHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("ETag", "9af2f8218b150c351ad802c6f3d66abe")
w.WriteHeader(http.StatusOK)
case r.Method == "POST":
_, ok := r.URL.Query()["uploads"]
if ok {
response := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><InitiateMultipartUploadResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Bucket>example-bucket</Bucket><Key>object</Key><UploadId>XXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA</UploadId></InitiateMultipartUploadResult>")
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
w.Write(response)
return
}
case r.Method == "GET":
_, ok := r.URL.Query()["uploadId"]
if ok {
uploadID := r.URL.Query().Get("uploadId")
if uploadID != "XXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA" {
w.WriteHeader(http.StatusNotFound)
return
}
response := []byte("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ListPartsResult xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Bucket>example-bucket</Bucket><Key>example-object</Key><UploadId>XXBsb2FkIElEIGZvciBlbHZpbmcncyVcdS1tb3ZpZS5tMnRzEEEwbG9hZA</UploadId><Initiator><ID>arn:aws:iam::111122223333:user/some-user-11116a31-17b5-4fb7-9df5-b288870f11xx</ID><DisplayName>umat-user-11116a31-17b5-4fb7-9df5-b288870f11xx</DisplayName></Initiator><Owner><ID>75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a</ID><DisplayName>someName</DisplayName></Owner><StorageClass>STANDARD</StorageClass><PartNumberMarker>1</PartNumberMarker><NextPartNumberMarker>3</NextPartNumberMarker><MaxParts>2</MaxParts><IsTruncated>true</IsTruncated><Part><PartNumber>2</PartNumber><LastModified>2010-11-10T20:48:34.000Z</LastModified><ETag>\"7778aef83f66abc1fa1e8477f296d394\"</ETag><Size>10485760</Size></Part><Part><PartNumber>3</PartNumber><LastModified>2010-11-10T20:48:33.000Z</LastModified><ETag>\"aaaa18db4cc2f85cedef654fccc4a4x8\"</ETag><Size>10485760</Size></Part></ListPartsResult>")
w.Header().Set("Content-Length", strconv.Itoa(len(response)))
w.Write(response)
return
}
if r.URL.Path != h.resource {
w.WriteHeader(http.StatusNotFound)
return
+1 -1
View File
@@ -9,7 +9,7 @@ import (
)
// Version autogenerated
var Version = "2015-06-07T02:49:54.701568725Z"
var Version = "2015-06-11T04:16:07.806453642Z"
// getVersion -
func getVersion() string {