server: Remove max-buckets option and now max buckets is unlimited.

minio server max-buckets option removed. min-free-disk option is
now a flag.
This commit is contained in:
Harshavardhana
2016-02-06 18:22:50 -08:00
parent e7fec22224
commit f4c8120cf9
5 changed files with 25 additions and 64 deletions

View File

@@ -17,15 +17,13 @@
package fs
import (
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strings"
"github.com/minio/minio-xl/pkg/probe"
"github.com/minio/minio/pkg/disk"
"github.com/minio/minio/pkg/ioutils"
)
/// Bucket Operations
@@ -71,14 +69,9 @@ func (fs Filesystem) DeleteBucket(bucket string) *probe.Error {
// ListBuckets - Get service.
func (fs Filesystem) ListBuckets() ([]BucketMetadata, *probe.Error) {
files, err := ioutils.ReadDirN(fs.path, fs.maxBuckets)
if err != nil && err != io.EOF {
return []BucketMetadata{}, probe.NewError(err)
}
if err == io.EOF {
// This message is printed if there are more than 1000 buckets
// and we saw io.EOF.
fmt.Printf("More buckets found, truncating the bucket list to %d entries only.", fs.maxBuckets)
files, e := ioutil.ReadDir(fs.path)
if e != nil {
return []BucketMetadata{}, probe.NewError(e)
}
var metadataList []BucketMetadata
for _, file := range files {
@@ -184,15 +177,15 @@ func (fs Filesystem) MakeBucket(bucket, acl string) *probe.Error {
// corresponding valid bucketnames on the backend in a platform
// compatible way for all operating systems.
func (fs Filesystem) denormalizeBucket(bucket string) string {
buckets, e := ioutils.ReadDirNamesN(fs.path, fs.maxBuckets)
buckets, e := ioutil.ReadDir(fs.path)
if e != nil {
return bucket
}
for _, b := range buckets {
// Verify if lowercase version of the bucket is equal to the
// incoming bucket, then use the proper name.
if strings.ToLower(b) == bucket {
return b
if strings.ToLower(b.Name()) == bucket {
return b.Name()
}
}
return bucket

View File

@@ -29,7 +29,6 @@ import (
type Filesystem struct {
path string
minFreeDisk int64
maxBuckets int
rwLock *sync.RWMutex
multiparts *Multiparts
buckets *Buckets
@@ -59,7 +58,7 @@ type Multiparts struct {
}
// New instantiate a new donut
func New(rootPath string, minFreeDisk int64, maxBuckets int) (Filesystem, *probe.Error) {
func New(rootPath string, minFreeDisk int64) (Filesystem, *probe.Error) {
setFSBucketsMetadataPath(filepath.Join(rootPath, "$buckets.json"))
setFSMultipartsMetadataPath(filepath.Join(rootPath, "$multiparts-session.json"))
@@ -104,8 +103,6 @@ func New(rootPath string, minFreeDisk int64, maxBuckets int) (Filesystem, *probe
fs.buckets = buckets
/// Defaults
// maximum buckets to be listed from list buckets.
fs.maxBuckets = maxBuckets
// minium free disk required for i/o operations to succeed.
fs.minFreeDisk = minFreeDisk

View File

@@ -36,7 +36,7 @@ func (s *MySuite) TestAPISuite(c *C) {
path, e := ioutil.TempDir(os.TempDir(), "minio-")
c.Check(e, IsNil)
storageList = append(storageList, path)
store, err := New(path, 0, 1000)
store, err := New(path, 0)
c.Check(err, IsNil)
return store
}