diff --git a/cmd-ls.go b/cmd-ls.go index 29a04a16..91e60ef1 100644 --- a/cmd-ls.go +++ b/cmd-ls.go @@ -81,7 +81,7 @@ func doListCmd(ctx *cli.Context) { if targetURLParser.bucketName == "" && targetURLParser.scheme != urlFS { var err error var buckets []*client.Bucket - for r := retries.init(); r.retry(); { + for r := tries.init(); r.try(); { buckets, err = clnt.ListBuckets() if !isValidRetry(err) { break @@ -91,9 +91,10 @@ func doListCmd(ctx *cli.Context) { log.Debug.Println(iodine.New(err, nil)) console.Fatalln("mc: Unable to list buckets for ", targetURLParser.String()) } + console.Infoln() printBuckets(buckets) } else { - for r := retries.init(); r.retry(); { + for r := tries.init(); r.try(); { items, err = clnt.ListObjects(targetURLParser.bucketName, targetURLParser.objectName) if !isValidRetry(err) { break @@ -103,6 +104,7 @@ func doListCmd(ctx *cli.Context) { log.Debug.Println(iodine.New(err, nil)) console.Fatalln("mc: Unable to list objects for ", targetURLParser.String()) } + console.Infoln() printObjects(items) } } diff --git a/cmd-mb.go b/cmd-mb.go index 9cbf0ae2..81273d75 100644 --- a/cmd-mb.go +++ b/cmd-mb.go @@ -54,8 +54,8 @@ func doMakeBucketCmd(ctx *cli.Context) { log.Debug.Println(iodine.New(err, nil)) console.Fatalf("mc: Unable to create new client to: %s", targetURLParser.String()) } - // retry - 5 times - for r := retries.init(); r.retry(); { + // try - 5 times + for r := tries.init(); r.try(); { err = clnt.PutBucket(targetURLParser.bucketName) if !isValidRetry(err) { break diff --git a/pkg/client/s3/bucket_internal.go b/pkg/client/s3/bucket_internal.go index ca0abd31..4abb8f4d 100644 --- a/pkg/client/s3/bucket_internal.go +++ b/pkg/client/s3/bucket_internal.go @@ -1,3 +1,19 @@ +/* + * Mini Copy, (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package s3 import ( diff --git a/pkg/client/s3/trace.go b/pkg/client/s3/trace.go index 9d568d41..3b9c1361 100644 --- a/pkg/client/s3/trace.go +++ b/pkg/client/s3/trace.go @@ -1,5 +1,5 @@ /* - * Mini Copy, (C) 2014,2015 Minio, Inc. + * Mini Copy, (C) 2015 Minio, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/retry.go b/try.go similarity index 71% rename from retry.go rename to try.go index 05d43b29..ffe7248c 100644 --- a/retry.go +++ b/try.go @@ -1,3 +1,19 @@ +/* + * Mini Copy, (C) 2015 Minio, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package main import ( @@ -33,7 +49,7 @@ func isValidRetry(err error) bool { } // TODO: this is global, make it configurable -var retries = waitTime{ +var tries = waitTime{ duration: 5 * time.Second, delayDuration: 1 * time.Second, } @@ -44,7 +60,7 @@ type waitTime struct { delayDuration time.Duration // delay interval between each retry } -type retryOp struct { +type tryOp struct { waittime waitTime last time.Time end time.Time @@ -52,18 +68,18 @@ type retryOp struct { } // instantiate new sequence of retries for the given waittime. -func (s waitTime) init() *retryOp { +func (s waitTime) init() *tryOp { + console.Error("trying... ") now := time.Now() - console.Error("Retrying... ") - return &retryOp{ + return &tryOp{ waittime: s, last: now, end: now.Add(s.duration), } } -// -func (a *retryOp) retry() bool { +// try() +func (a *tryOp) try() bool { // grab current time now := time.Now()