From 16d489fa3bc35bfeaccc8e00d1b9bbb22d4f1205 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 8 Oct 2015 15:19:29 -0700 Subject: [PATCH] Anticipating streaming input vendorize changes from minio-go, minio-go-legacy. Progressbar doesn't add to Total value if its a streaming input, this provides us infinite progress bar. --- pb.go => progress-bar.go | 4 +++- vendor/github.com/minio/minio-go-legacy/api.go | 6 +++--- vendor/github.com/minio/minio-go/api.go | 6 +++--- vendor/vendor.json | 8 ++++---- 4 files changed, 13 insertions(+), 11 deletions(-) rename pb.go => progress-bar.go (98%) diff --git a/pb.go b/progress-bar.go similarity index 98% rename from pb.go rename to progress-bar.go index 393f1873..fd622de8 100644 --- a/pb.go +++ b/progress-bar.go @@ -178,7 +178,9 @@ func newProgressBar() barSend { case pbBarSetCaption: bar.Prefix(fixateBarCaption(msg.Arg.(string), getFixedWidth(bar.GetWidth(), 18))) case pbBarExtend: - atomic.AddInt64(&bar.Total, msg.Arg.(int64)) + if msg.Arg.(int64) > 0 { + atomic.AddInt64(&bar.Total, msg.Arg.(int64)) + } case pbBarProgress: if bar.Total > 0 && !started { started = true diff --git a/vendor/github.com/minio/minio-go-legacy/api.go b/vendor/github.com/minio/minio-go-legacy/api.go index 451497c5..8083a8f3 100644 --- a/vendor/github.com/minio/minio-go-legacy/api.go +++ b/vendor/github.com/minio/minio-go-legacy/api.go @@ -329,7 +329,7 @@ func (a api) newObjectUpload(bucket, object, contentType string, size int64, dat for p := range chopper(data, partSize, nil) { // This check is primarily for last part // This verifies if the part.Len was an unexpected read i.e if we lost few bytes - if p.Len < partSize { + if p.Len < partSize && size > 0 { expectedPartLen := size - totalLength if expectedPartLen != p.Len { return ErrorResponse{ @@ -460,7 +460,7 @@ func (a api) continueObjectUpload(bucket, object, uploadID string, size int64, d for p := range chopper(data, partSize, skipParts) { // This check is primarily for last part // This verifies if the part.Len was an unexpected read i.e if we lost few bytes - if p.Len < partSize { + if p.Len < partSize && size > 0 { expectedPartLen := size - totalLength if expectedPartLen != p.Len { return ErrorResponse{ @@ -580,7 +580,7 @@ func (a api) PutObject(bucket, object, contentType string, size int64, data io.R } } switch { - case size < minimumPartSize: + case size < minimumPartSize && size > 0: // Single Part use case, use PutObject directly for part := range chopper(data, minimumPartSize, nil) { if part.Err != nil { diff --git a/vendor/github.com/minio/minio-go/api.go b/vendor/github.com/minio/minio-go/api.go index 03b016b8..467337e2 100644 --- a/vendor/github.com/minio/minio-go/api.go +++ b/vendor/github.com/minio/minio-go/api.go @@ -331,7 +331,7 @@ func (a api) newObjectUpload(bucket, object, contentType string, size int64, dat for p := range chopper(data, partSize, nil) { // This check is primarily for last part // This verifies if the part.Len was an unexpected read i.e if we lost few bytes - if p.Len < partSize { + if p.Len < partSize && size > 0 { expectedPartLen := size - totalLength if expectedPartLen != p.Len { return ErrorResponse{ @@ -462,7 +462,7 @@ func (a api) continueObjectUpload(bucket, object, uploadID string, size int64, d for p := range chopper(data, partSize, skipParts) { // This check is primarily for last part // This verifies if the part.Len was an unexpected read i.e if we lost few bytes - if p.Len < partSize { + if p.Len < partSize && size > 0 { expectedPartLen := size - totalLength if expectedPartLen != p.Len { return ErrorResponse{ @@ -596,7 +596,7 @@ func (a api) PutObject(bucket, object, contentType string, size int64, data io.R } } switch { - case size < minimumPartSize: + case size < minimumPartSize && size > 0: // Single Part use case, use PutObject directly for part := range chopper(data, minimumPartSize, nil) { if part.Err != nil { diff --git a/vendor/vendor.json b/vendor/vendor.json index 3e8c57cc..130494a5 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -29,13 +29,13 @@ }, { "path": "github.com/minio/minio-go", - "revision": "26948ab46dafaa60c6e14637ebfc1eb43802cb6c", - "revisionTime": "2015-10-06T11:59:55-07:00" + "revision": "06751b70f167c449567508aa8655a84de50609a6", + "revisionTime": "2015-10-08T15:16:48-07:00" }, { "path": "github.com/minio/minio-go-legacy", - "revision": "e05bb3d90ec884a5f3952134906dfa22fb48edd9", - "revisionTime": "2015-10-02T12:38:52-07:00" + "revision": "dda8ea3a7d8ce5571c41fe5c465330113cbb8a6b", + "revisionTime": "2015-10-08T15:15:47-07:00" }, { "path": "github.com/minio/minio/pkg/probe",