mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
Export bucket usage counts as part of bucket metrics (#9710)
Bonus fixes in quota enforcement to use the new datastructure and use timedValue to cache a value/reload automatically avoids one less global variable.
This commit is contained in:
@@ -154,6 +154,22 @@ func loadDataUsageFromBackend(ctx context.Context, objAPI ObjectLayer) (DataUsag
|
||||
return DataUsageInfo{}, err
|
||||
}
|
||||
|
||||
// For forward compatibility reasons, we need to add this code.
|
||||
if len(dataUsageInfo.BucketsUsage) == 0 {
|
||||
dataUsageInfo.BucketsUsage = make(map[string]BucketUsageInfo, len(dataUsageInfo.BucketSizes))
|
||||
for bucket, size := range dataUsageInfo.BucketSizes {
|
||||
dataUsageInfo.BucketsUsage[bucket] = BucketUsageInfo{Size: size}
|
||||
}
|
||||
}
|
||||
|
||||
// For backward compatibility reasons, we need to add this code.
|
||||
if len(dataUsageInfo.BucketSizes) == 0 {
|
||||
dataUsageInfo.BucketSizes = make(map[string]uint64, len(dataUsageInfo.BucketsUsage))
|
||||
for bucket, bui := range dataUsageInfo.BucketsUsage {
|
||||
dataUsageInfo.BucketSizes[bucket] = bui.Size
|
||||
}
|
||||
}
|
||||
|
||||
return dataUsageInfo, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user