Use single place for Maxkeys at client interface
This commit is contained in:
+1
-1
@@ -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
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user