diff options
Diffstat (limited to 'vendor/github.com/minio/minio-go')
-rw-r--r-- | vendor/github.com/minio/minio-go/README.md | 2 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/api-list.go | 27 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/api-put-object.go | 6 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/api-remove.go | 10 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/api.go | 2 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/core.go | 6 | ||||
-rw-r--r-- | vendor/github.com/minio/minio-go/functional_tests.go | 44 |
7 files changed, 47 insertions, 50 deletions
diff --git a/vendor/github.com/minio/minio-go/README.md b/vendor/github.com/minio/minio-go/README.md index 91b42049f..e004a4b05 100644 --- a/vendor/github.com/minio/minio-go/README.md +++ b/vendor/github.com/minio/minio-go/README.md @@ -139,7 +139,7 @@ The full API Reference is available here. ### API Reference : File Object Operations * [`FPutObject`](https://docs.minio.io/docs/golang-client-api-reference#FPutObject) -* [`FGetObject`](https://docs.minio.io/docs/golang-client-api-reference#FPutObject) +* [`FGetObject`](https://docs.minio.io/docs/golang-client-api-reference#FGetObject) * [`FPutObjectWithContext`](https://docs.minio.io/docs/golang-client-api-reference#FPutObjectWithContext) * [`FGetObjectWithContext`](https://docs.minio.io/docs/golang-client-api-reference#FGetObjectWithContext) diff --git a/vendor/github.com/minio/minio-go/api-list.go b/vendor/github.com/minio/minio-go/api-list.go index 3cfb47d37..04f757339 100644 --- a/vendor/github.com/minio/minio-go/api-list.go +++ b/vendor/github.com/minio/minio-go/api-list.go @@ -118,7 +118,7 @@ func (c Client) ListObjectsV2(bucketName, objectPrefix string, recursive bool, d var continuationToken string for { // Get list of objects a maximum of 1000 per request. - result, err := c.listObjectsV2Query(bucketName, objectPrefix, continuationToken, fetchOwner, delimiter, 1000) + result, err := c.listObjectsV2Query(bucketName, objectPrefix, continuationToken, fetchOwner, delimiter, 1000, "") if err != nil { objectStatCh <- ObjectInfo{ Err: err, @@ -171,11 +171,12 @@ func (c Client) ListObjectsV2(bucketName, objectPrefix string, recursive bool, d // You can use the request parameters as selection criteria to return a subset of the objects in a bucket. // request parameters :- // --------- -// ?continuation-token - Specifies the key to start with when listing objects in a bucket. +// ?continuation-token - Used to continue iterating over a set of objects // ?delimiter - A delimiter is a character you use to group keys. // ?prefix - Limits the response to keys that begin with the specified prefix. // ?max-keys - Sets the maximum number of keys returned in the response body. -func (c Client) listObjectsV2Query(bucketName, objectPrefix, continuationToken string, fetchOwner bool, delimiter string, maxkeys int) (ListBucketV2Result, error) { +// ?start-after - Specifies the key to start after when listing objects in a bucket. +func (c Client) listObjectsV2Query(bucketName, objectPrefix, continuationToken string, fetchOwner bool, delimiter string, maxkeys int, startAfter string) (ListBucketV2Result, error) { // Validate bucket name. if err := s3utils.CheckValidBucketName(bucketName); err != nil { return ListBucketV2Result{}, err @@ -216,6 +217,11 @@ func (c Client) listObjectsV2Query(bucketName, objectPrefix, continuationToken s // Set max keys. urlValues.Set("max-keys", fmt.Sprintf("%d", maxkeys)) + // Set start-after + if startAfter != "" { + urlValues.Set("start-after", startAfter) + } + // Execute GET on bucket to list objects. resp, err := c.executeMethod(context.Background(), "GET", requestMetadata{ bucketName: bucketName, @@ -627,30 +633,27 @@ func (c Client) listObjectParts(bucketName, objectName, uploadID string) (partsI return partsInfo, nil } -// findUploadID lists all incomplete uploads and finds the uploadID of the matching object name. -func (c Client) findUploadID(bucketName, objectName string) (uploadID string, err error) { +// findUploadIDs lists all incomplete uploads and find the uploadIDs of the matching object name. +func (c Client) findUploadIDs(bucketName, objectName string) ([]string, error) { + var uploadIDs []string // Make list incomplete uploads recursive. isRecursive := true // Turn off size aggregation of individual parts, in this request. isAggregateSize := false - // latestUpload to track the latest multipart info for objectName. - var latestUpload ObjectMultipartInfo // Create done channel to cleanup the routine. doneCh := make(chan struct{}) defer close(doneCh) // List all incomplete uploads. for mpUpload := range c.listIncompleteUploads(bucketName, objectName, isRecursive, isAggregateSize, doneCh) { if mpUpload.Err != nil { - return "", mpUpload.Err + return nil, mpUpload.Err } if objectName == mpUpload.Key { - if mpUpload.Initiated.Sub(latestUpload.Initiated) > 0 { - latestUpload = mpUpload - } + uploadIDs = append(uploadIDs, mpUpload.UploadID) } } // Return the latest upload id. - return latestUpload.UploadID, nil + return uploadIDs, nil } // getTotalMultipartSize - calculate total uploaded size for the a given multipart object. diff --git a/vendor/github.com/minio/minio-go/api-put-object.go b/vendor/github.com/minio/minio-go/api-put-object.go index 45ae11d6c..0330cd99d 100644 --- a/vendor/github.com/minio/minio-go/api-put-object.go +++ b/vendor/github.com/minio/minio-go/api-put-object.go @@ -28,7 +28,7 @@ import ( "github.com/minio/minio-go/pkg/encrypt" "github.com/minio/minio-go/pkg/s3utils" - "golang.org/x/net/lex/httplex" + "golang.org/x/net/http/httpguts" ) // PutObjectOptions represents options specified by user for PutObject call @@ -101,10 +101,10 @@ func (opts PutObjectOptions) Header() (header http.Header) { // validate() checks if the UserMetadata map has standard headers or and raises an error if so. func (opts PutObjectOptions) validate() (err error) { for k, v := range opts.UserMetadata { - if !httplex.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) { + if !httpguts.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) { return ErrInvalidArgument(k + " unsupported user defined metadata name") } - if !httplex.ValidHeaderFieldValue(v) { + if !httpguts.ValidHeaderFieldValue(v) { return ErrInvalidArgument(v + " unsupported user defined metadata value") } } diff --git a/vendor/github.com/minio/minio-go/api-remove.go b/vendor/github.com/minio/minio-go/api-remove.go index c2ffcdd34..f33df4dfc 100644 --- a/vendor/github.com/minio/minio-go/api-remove.go +++ b/vendor/github.com/minio/minio-go/api-remove.go @@ -233,18 +233,20 @@ func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error { if err := s3utils.CheckValidObjectName(objectName); err != nil { return err } - // Find multipart upload id of the object to be aborted. - uploadID, err := c.findUploadID(bucketName, objectName) + // Find multipart upload ids of the object to be aborted. + uploadIDs, err := c.findUploadIDs(bucketName, objectName) if err != nil { return err } - if uploadID != "" { - // Upload id found, abort the incomplete multipart upload. + + for _, uploadID := range uploadIDs { + // abort incomplete multipart upload, based on the upload id passed. err := c.abortMultipartUpload(context.Background(), bucketName, objectName, uploadID) if err != nil { return err } } + return nil } diff --git a/vendor/github.com/minio/minio-go/api.go b/vendor/github.com/minio/minio-go/api.go index 03778b04c..237ddbcae 100644 --- a/vendor/github.com/minio/minio-go/api.go +++ b/vendor/github.com/minio/minio-go/api.go @@ -99,7 +99,7 @@ type Options struct { // Global constants. const ( libraryName = "minio-go" - libraryVersion = "6.0.1" + libraryVersion = "v6.0.3" ) // User Agent should always following the below style. diff --git a/vendor/github.com/minio/minio-go/core.go b/vendor/github.com/minio/minio-go/core.go index 31dbcd12e..a5017d868 100644 --- a/vendor/github.com/minio/minio-go/core.go +++ b/vendor/github.com/minio/minio-go/core.go @@ -48,9 +48,9 @@ func (c Core) ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) } // ListObjectsV2 - Lists all the objects at a prefix, similar to ListObjects() but uses -// continuationToken instead of marker to further filter the results. -func (c Core) ListObjectsV2(bucketName, objectPrefix, continuationToken string, fetchOwner bool, delimiter string, maxkeys int) (ListBucketV2Result, error) { - return c.listObjectsV2Query(bucketName, objectPrefix, continuationToken, fetchOwner, delimiter, maxkeys) +// continuationToken instead of marker to support iteration over the results. +func (c Core) ListObjectsV2(bucketName, objectPrefix, continuationToken string, fetchOwner bool, delimiter string, maxkeys int, startAfter string) (ListBucketV2Result, error) { + return c.listObjectsV2Query(bucketName, objectPrefix, continuationToken, fetchOwner, delimiter, maxkeys, startAfter) } // CopyObject - copies an object from source object to destination object on server side. diff --git a/vendor/github.com/minio/minio-go/functional_tests.go b/vendor/github.com/minio/minio-go/functional_tests.go index 421b30e8e..e4ea9b647 100644 --- a/vendor/github.com/minio/minio-go/functional_tests.go +++ b/vendor/github.com/minio/minio-go/functional_tests.go @@ -2623,8 +2623,14 @@ func testCopyObject() { return } + oi, err := c.StatObject(bucketName, objectName, minio.StatObjectOptions{}) + if err != nil { + logError(testName, function, args, startTime, "", "StatObject failed", err) + return + } + stOpts := minio.StatObjectOptions{} - stOpts.SetMatchETag(objInfo.ETag) + stOpts.SetMatchETag(oi.ETag) objInfo, err = c.StatObject(bucketName, objectName, stOpts) if err != nil { logError(testName, function, args, startTime, "", "CopyObject ETag should match and not fail", err) @@ -3491,15 +3497,11 @@ func testFunctional() { args = map[string]interface{}{ "bucketName": bucketName, } - readOnlyPolicyRet, err := c.GetBucketPolicy(bucketName) + _, err = c.GetBucketPolicy(bucketName) if err != nil { logError(testName, function, args, startTime, "", "GetBucketPolicy failed", err) return } - if readOnlyPolicyRet == "" { - logError(testName, function, args, startTime, "", "policy should be set", err) - return - } // Make the bucket 'public writeonly'. function = "SetBucketPolicy(bucketName, writeOnlyPolicy)" @@ -3523,17 +3525,12 @@ func testFunctional() { "bucketName": bucketName, } - writeOnlyPolicyRet, err := c.GetBucketPolicy(bucketName) + _, err = c.GetBucketPolicy(bucketName) if err != nil { logError(testName, function, args, startTime, "", "GetBucketPolicy failed", err) return } - if writeOnlyPolicyRet == "" { - logError(testName, function, args, startTime, "", "policy should be set", err) - return - } - // Make the bucket 'public read/write'. function = "SetBucketPolicy(bucketName, readWritePolicy)" functionAll += ", " + function @@ -3556,17 +3553,12 @@ func testFunctional() { args = map[string]interface{}{ "bucketName": bucketName, } - readWritePolicyRet, err := c.GetBucketPolicy(bucketName) + _, err = c.GetBucketPolicy(bucketName) if err != nil { logError(testName, function, args, startTime, "", "GetBucketPolicy failed", err) return } - if readWritePolicyRet == "" { - logError(testName, function, args, startTime, "", "policy should be set", err) - return - } - // List all buckets. function = "ListBuckets()" functionAll += ", " + function @@ -7389,12 +7381,12 @@ func testListObjects() { return } if objInfo.Key == objectName1 && objInfo.StorageClass != "STANDARD" { - logError(testName, function, args, startTime, "", "ListObjects doesn't return expected storage class", err) - return + // Ignored as Gateways (Azure/GCS etc) wont return storage class + ignoredLog(testName, function, args, startTime, "ListObjects doesn't return expected storage class").Info() } if objInfo.Key == objectName2 && objInfo.StorageClass != "REDUCED_REDUNDANCY" { - logError(testName, function, args, startTime, "", "ListObjects doesn't return expected storage class", err) - return + // Ignored as Gateways (Azure/GCS etc) wont return storage class + ignoredLog(testName, function, args, startTime, "ListObjects doesn't return expected storage class").Info() } } @@ -7405,12 +7397,12 @@ func testListObjects() { return } if objInfo.Key == objectName1 && objInfo.StorageClass != "STANDARD" { - logError(testName, function, args, startTime, "", "ListObjectsV2 doesn't return expected storage class", err) - return + // Ignored as Gateways (Azure/GCS etc) wont return storage class + ignoredLog(testName, function, args, startTime, "ListObjectsV2 doesn't return expected storage class").Info() } if objInfo.Key == objectName2 && objInfo.StorageClass != "REDUCED_REDUNDANCY" { - logError(testName, function, args, startTime, "", "ListObjectsV2 doesn't return expected storage class", err) - return + // Ignored as Gateways (Azure/GCS etc) wont return storage class + ignoredLog(testName, function, args, startTime, "ListObjectsV2 doesn't return expected storage class").Info() } } |