Use single place for Maxkeys at client interface

This commit is contained in:
Harshavardhana
2015-03-30 19:07:23 -07:00
parent 0c0fcedff9
commit 7e6c1cc705
4 changed files with 5 additions and 11 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ func doRecursiveCP(c *cli.Context, args *cmdArgs) error {
if err != nil {
return err
}
items, _, err := s3c.ListObjects(args.source.bucket, "", "", "", s3.MaxKeys)
items, _, err := s3c.ListObjects(args.source.bucket, "", "", "", client.Maxkeys)
if err != nil {
return err
}
+2 -3
View File
@@ -24,7 +24,6 @@ import (
"github.com/cheggaaa/pb"
"github.com/minio-io/cli"
"github.com/minio-io/mc/pkg/client"
"github.com/minio-io/mc/pkg/client/s3"
)
const (
@@ -110,13 +109,13 @@ func doListCmd(c *cli.Context) {
}
printBuckets(buckets)
case objectName == "": // List objects in a bucket
items, _, err = s3c.ListObjects(bucketName, "", "", "", s3.MaxKeys)
items, _, err = s3c.ListObjects(bucketName, "", "", "", client.Maxkeys)
if err != nil {
fatal(err.Error())
}
printObjects(items)
case objectName != "": // List objects matching the key prefix
listObjectPrefix(s3c, bucketName, objectName, s3.MaxKeys)
listObjectPrefix(s3c, bucketName, objectName, client.Maxkeys)
default:
fatal(err.Error())
}
+2 -2
View File
@@ -182,8 +182,8 @@ func (c *s3Client) ListObjects(bucket string, startAt, prefix, delimiter string,
marker := startAt
for len(items) < maxKeys {
fetchN := maxKeys - len(items)
if fetchN > MaxKeys {
fetchN = MaxKeys
if fetchN > client.Maxkeys {
fetchN = client.Maxkeys
}
var bres listBucketResults
buffer.WriteString(fmt.Sprintf("%s?max-keys=%d", c.bucketURL(bucket), fetchN))
-5
View File
@@ -53,11 +53,6 @@ import (
"github.com/minio-io/mc/pkg/client"
)
// Total max object list
const (
MaxKeys = 1000
)
type listBucketResults struct {
Contents []*client.Item
IsTruncated bool