diff options
| author | chrislu <chris.lu@gmail.com> | 2022-03-04 18:47:44 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-03-04 18:47:44 -0800 |
| commit | 6e49e75a5b70389d16026b52ba5001d09cea2c7f (patch) | |
| tree | 62af19cb1ded88e128c92fce452da4cac143fd83 /weed/shell/command_s3_bucket_quota_check.go | |
| parent | f51e20028a381390bf1356e2ccd181838059cde9 (diff) | |
| download | seaweedfs-6e49e75a5b70389d16026b52ba5001d09cea2c7f.tar.xz seaweedfs-6e49e75a5b70389d16026b52ba5001d09cea2c7f.zip | |
use logical number of files and sizes for statistics and quota
Diffstat (limited to 'weed/shell/command_s3_bucket_quota_check.go')
| -rw-r--r-- | weed/shell/command_s3_bucket_quota_check.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/weed/shell/command_s3_bucket_quota_check.go b/weed/shell/command_s3_bucket_quota_check.go index 066ef6909..a901af077 100644 --- a/weed/shell/command_s3_bucket_quota_check.go +++ b/weed/shell/command_s3_bucket_quota_check.go @@ -65,7 +65,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv, return nil } collection := entry.Name - var collectionSize uint64 + var collectionSize float64 if collectionInfo, found := collectionInfos[collection]; found { collectionSize = collectionInfo.Size } @@ -95,7 +95,7 @@ func (c *commandS3BucketQuotaEnforce) Do(args []string, commandEnv *CommandEnv, } -func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, filerBucketsPath string, entry *filer_pb.Entry, writer io.Writer, collectionSize uint64) (hasConfChanges bool) { +func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, filerBucketsPath string, entry *filer_pb.Entry, writer io.Writer, collectionSize float64) (hasConfChanges bool) { locPrefix := filerBucketsPath + "/" + entry.Name + "/" locConf := fc.MatchStorageRule(locPrefix) @@ -103,12 +103,12 @@ func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, fil if entry.Quota > 0 { if locConf.ReadOnly { - if collectionSize < uint64(entry.Quota) { + if collectionSize < float64(entry.Quota) { locConf.ReadOnly = false hasConfChanges = true } } else { - if collectionSize > uint64(entry.Quota) { + if collectionSize > float64(entry.Quota) { locConf.ReadOnly = true hasConfChanges = true } @@ -122,7 +122,7 @@ func (c *commandS3BucketQuotaEnforce) processEachBucket(fc *filer.FilerConf, fil if hasConfChanges { fmt.Fprintf(writer, " %s\tsize:%d", entry.Name, collectionSize) - fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, float64(collectionSize)*100/float64(entry.Quota)) + fmt.Fprintf(writer, "\tquota:%d\tusage:%.2f%%", entry.Quota, collectionSize*100/float64(entry.Quota)) fmt.Fprintln(writer) if locConf.ReadOnly { fmt.Fprintf(writer, " changing bucket %s to read only!\n", entry.Name) |
