Converge repeated code to common deleteBucketMetadata() (#5508)

This commit is contained in:
Harshavardhana
2018-02-12 18:34:30 -08:00
committed by kannappanr
parent 8de6cf4124
commit 91101b11bb
3 changed files with 23 additions and 29 deletions

View File

@@ -281,22 +281,9 @@ func (xl xlObjects) DeleteBucket(bucket string) error {
if err != nil {
return toObjectErr(err, bucket)
}
// Delete bucket access policy, if present - ignore any errors.
_ = removeBucketPolicy(bucket, xl)
// Notify all peers (including self) to update in-memory state
S3PeersUpdateBucketPolicy(bucket)
// Delete notification config, if present - ignore any errors.
_ = removeNotificationConfig(bucket, xl)
// Notify all peers (including self) to update in-memory state
S3PeersUpdateBucketNotification(bucket, nil)
// Delete listener config, if present - ignore any errors.
_ = removeListenerConfig(bucket, xl)
// Notify all peers (including self) to update in-memory state
S3PeersUpdateBucketListener(bucket, []listenerConfig{})
// Delete all bucket metadata.
deleteBucketMetadata(bucket, xl)
return nil
}