mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 12:40:24 +03:00
heal: Add ListBucketsHeal object API (#3563)
ListBucketsHeal will list which buckets that need to be healed: * ListBucketsHeal() (buckets []BucketInfo, err error)
This commit is contained in:
committed by
Harshavardhana
parent
dfc2ef3004
commit
0715032598
+30
-2
@@ -171,8 +171,8 @@ __Example__
|
||||
log.Fatalln(err)
|
||||
return
|
||||
}
|
||||
if object.HealInfo != nil {
|
||||
switch healInfo := *object.HealInfo; healInfo.Status {
|
||||
if object.HealObjectInfo != nil {
|
||||
switch healInfo := *object.HealObjectInfo; healInfo.Status {
|
||||
case madmin.CanHeal:
|
||||
fmt.Println(object.Key, " can be healed.")
|
||||
case madmin.QuorumUnavailable:
|
||||
@@ -185,6 +185,34 @@ __Example__
|
||||
}
|
||||
```
|
||||
|
||||
<a name="ListBucketsList"></a>
|
||||
### ListBucketsList() error
|
||||
If successful returns information on the list of buckets that need healing.
|
||||
|
||||
__Example__
|
||||
|
||||
``` go
|
||||
// List buckets that need healing
|
||||
healBucketsList, err := madmClnt.ListBucketsHeal()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
for bucket := range healBucketsList {
|
||||
if bucket.HealBucketInfo != nil {
|
||||
switch healInfo := *object.HealBucketInfo; healInfo.Status {
|
||||
case madmin.CanHeal:
|
||||
fmt.Println(bucket.Key, " can be healed.")
|
||||
case madmin.QuorumUnavailable:
|
||||
fmt.Println(bucket.Key, " can't be healed until quorum is available.")
|
||||
case madmin.Corrupted:
|
||||
fmt.Println(bucket.Key, " can't be healed, not enough information.")
|
||||
}
|
||||
}
|
||||
fmt.Println("bucket: ", bucket)
|
||||
}
|
||||
```
|
||||
|
||||
<a name="HealBucket"></a>
|
||||
### HealBucket(bucket string, isDryRun bool) error
|
||||
If bucket is successfully healed returns nil, otherwise returns error indicating the reason for failure. If isDryRun is true, then the bucket is not healed, but heal bucket request is validated by the server. e.g, if the bucket exists, if bucket name is valid etc.
|
||||
|
||||
Reference in New Issue
Block a user