From 1341fb79c33fadfb41d5ddff800d6db052a96026 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 26 Jan 2016 11:48:52 -0800 Subject: [PATCH] listBuckets: Bump up the limit of max buckets to 1000. --- pkg/fs/fs-bucket-listobjects.go | 25 +++++++++++++++++-------- pkg/fs/fs.go | 2 +- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pkg/fs/fs-bucket-listobjects.go b/pkg/fs/fs-bucket-listobjects.go index 6a3e98dcd..ef031e277 100644 --- a/pkg/fs/fs-bucket-listobjects.go +++ b/pkg/fs/fs-bucket-listobjects.go @@ -27,14 +27,24 @@ import ( "github.com/minio/minio-xl/pkg/probe" ) +// listObjectsParams - list objects input parameters. type listObjectsParams struct { - Bucket string - Prefix string - Marker string + // Bucket name to list the objects for. + Bucket string + // list all objects with this parameter as common prefix. + Prefix string + // list all objects starting with object after marker in + // lexicographical order. + Marker string + // list all objects until the first occurrence of the delimtier + // after the prefix. Delimiter string - MaxKeys int + // maximum number of objects returned per listObjects() + // operation. + MaxKeys int } +// listServiceReq type listServiceReq struct { reqParams listObjectsParams respCh chan ListObjectsResult @@ -44,8 +54,7 @@ type listWorkerReq struct { respCh chan ListObjectsResult } -// listObjects - list objects lists objects upto maxKeys for a given -// prefix. +// listObjects - list objects lists objects upto maxKeys for a given prefix. func (fs Filesystem) listObjects(bucket, prefix, marker, delimiter string, maxKeys int) (chan<- listWorkerReq, *probe.Error) { quitWalker := make(chan bool) reqCh := make(chan listWorkerReq) @@ -67,7 +76,7 @@ func (fs Filesystem) listObjects(bucket, prefix, marker, delimiter string, maxKe walkPath = prefixPath } } - filepath.Walk(walkPath, func(path string, info os.FileInfo, err error) error { + Walk(walkPath, func(path string, info os.FileInfo, err error) error { // We don't need to list the walk path. if path == walkPath { return nil @@ -99,7 +108,7 @@ func (fs Filesystem) listObjects(bucket, prefix, marker, delimiter string, maxKe // If delimiter is set, we stop if current path is a // directory. if delimiter != "" && info.IsDir() { - return filepath.SkipDir + return ErrSkipDir } } return nil diff --git a/pkg/fs/fs.go b/pkg/fs/fs.go index 99248299c..ed88cf747 100644 --- a/pkg/fs/fs.go +++ b/pkg/fs/fs.go @@ -101,7 +101,7 @@ func New(rootPath string) (Filesystem, *probe.Error) { /// Defaults // maximum buckets to be listed from list buckets. - fs.maxBuckets = 100 + fs.maxBuckets = 1000 // minium free disk required for i/o operations to succeed. fs.minFreeDisk = 10