2021-04-18 12:41:13 -07:00
|
|
|
// Copyright (c) 2015-2021 MinIO, Inc.
|
|
|
|
//
|
|
|
|
// This file is part of MinIO Object Storage stack
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Affero General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Affero General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Affero General Public License
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2016-06-01 16:43:31 -07:00
|
|
|
|
2016-08-18 16:23:42 -07:00
|
|
|
package cmd
|
2016-05-20 20:48:47 -07:00
|
|
|
|
|
|
|
import (
|
2018-03-14 12:01:47 -07:00
|
|
|
"context"
|
2020-10-13 18:28:42 -07:00
|
|
|
"errors"
|
2017-11-25 11:58:29 -08:00
|
|
|
|
2021-06-01 14:59:40 -07:00
|
|
|
"github.com/minio/minio/internal/sync/errgroup"
|
2016-05-20 20:48:47 -07:00
|
|
|
)
|
|
|
|
|
2016-11-23 20:05:04 -08:00
|
|
|
// list all errors that can be ignore in a bucket operation.
|
2020-07-24 13:16:11 -07:00
|
|
|
var bucketOpIgnoredErrs = append(baseIgnoredErrs, errDiskAccessDenied, errUnformattedDisk)
|
2016-11-23 20:05:04 -08:00
|
|
|
|
2016-11-20 16:57:12 -08:00
|
|
|
// list all errors that can be ignored in a bucket metadata operation.
|
|
|
|
var bucketMetadataOpIgnoredErrs = append(bucketOpIgnoredErrs, errVolumeNotFound)
|
|
|
|
|
2022-07-25 17:51:32 -07:00
|
|
|
// markDelete creates a vol entry in .minio.sys/buckets/.deleted until site replication
|
|
|
|
// syncs the delete to peers
|
|
|
|
func (er erasureObjects) markDelete(ctx context.Context, bucket, prefix string) error {
|
|
|
|
storageDisks := er.getDisks()
|
|
|
|
g := errgroup.WithNErrs(len(storageDisks))
|
|
|
|
// Make a volume entry on all underlying storage disks.
|
|
|
|
for index := range storageDisks {
|
|
|
|
index := index
|
|
|
|
if storageDisks[index] == nil {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
g.Go(func() error {
|
|
|
|
if err := storageDisks[index].MakeVol(ctx, pathJoin(bucket, prefix)); err != nil {
|
|
|
|
if errors.Is(err, errVolumeExists) {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}, index)
|
2021-10-06 09:20:25 -07:00
|
|
|
}
|
2022-07-25 17:51:32 -07:00
|
|
|
err := reduceWriteQuorumErrs(ctx, g.Wait(), bucketOpIgnoredErrs, er.defaultWQuorum())
|
|
|
|
return toObjectErr(err, bucket)
|
|
|
|
}
|
2019-02-05 17:58:48 -08:00
|
|
|
|
2022-07-25 17:51:32 -07:00
|
|
|
// purgeDelete deletes vol entry in .minio.sys/buckets/.deleted after site replication
|
|
|
|
// syncs the delete to peers OR on a new MakeBucket call.
|
|
|
|
func (er erasureObjects) purgeDelete(ctx context.Context, bucket, prefix string) error {
|
|
|
|
storageDisks := er.getDisks()
|
|
|
|
g := errgroup.WithNErrs(len(storageDisks))
|
|
|
|
// Make a volume entry on all underlying storage disks.
|
|
|
|
for index := range storageDisks {
|
|
|
|
index := index
|
|
|
|
g.Go(func() error {
|
|
|
|
if storageDisks[index] != nil {
|
|
|
|
return storageDisks[index].DeleteVol(ctx, pathJoin(bucket, prefix), true)
|
|
|
|
}
|
|
|
|
return errDiskNotFound
|
|
|
|
}, index)
|
|
|
|
}
|
|
|
|
err := reduceWriteQuorumErrs(ctx, g.Wait(), bucketOpIgnoredErrs, er.defaultWQuorum())
|
2021-11-02 00:52:45 -04:00
|
|
|
return toObjectErr(err, bucket)
|
2018-02-09 15:19:30 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
// IsNotificationSupported returns whether bucket notification is applicable for this layer.
|
2020-06-12 20:04:01 -07:00
|
|
|
func (er erasureObjects) IsNotificationSupported() bool {
|
2018-02-09 15:19:30 -08:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2020-07-20 12:52:49 -07:00
|
|
|
// IsListenSupported returns whether listen bucket notification is applicable for this layer.
|
|
|
|
func (er erasureObjects) IsListenSupported() bool {
|
2018-12-05 14:03:42 -08:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2019-01-05 14:16:43 -08:00
|
|
|
// IsEncryptionSupported returns whether server side encryption is implemented for this layer.
|
2020-06-12 20:04:01 -07:00
|
|
|
func (er erasureObjects) IsEncryptionSupported() bool {
|
2018-02-09 15:19:30 -08:00
|
|
|
return true
|
2016-05-20 20:48:47 -07:00
|
|
|
}
|
2018-09-28 09:06:17 +05:30
|
|
|
|
|
|
|
// IsCompressionSupported returns whether compression is applicable for this layer.
|
2020-06-12 20:04:01 -07:00
|
|
|
func (er erasureObjects) IsCompressionSupported() bool {
|
2018-09-28 09:06:17 +05:30
|
|
|
return true
|
|
|
|
}
|
2020-05-23 11:09:35 -07:00
|
|
|
|
2020-06-12 20:04:01 -07:00
|
|
|
// IsTaggingSupported indicates whether erasureObjects implements tagging support.
|
|
|
|
func (er erasureObjects) IsTaggingSupported() bool {
|
2020-05-23 11:09:35 -07:00
|
|
|
return true
|
|
|
|
}
|