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.
This commit is contained in:
Harshavardhana
2015-10-08 15:26:05 -07:00
parent db4387c56a
commit 16d489fa3b
4 changed files with 13 additions and 11 deletions
+3 -1
View File
@@ -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
+3 -3
View File
@@ -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 {
+3 -3
View File
@@ -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 {
+4 -4
View File
@@ -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",