2017-03-16 20:21:58 +01:00
|
|
|
/*
|
2019-04-09 20:39:42 +02:00
|
|
|
* MinIO Cloud Storage, (C) 2017 MinIO, Inc.
|
2017-03-16 20:21:58 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package cmd
|
|
|
|
|
2017-10-22 07:30:34 +02:00
|
|
|
import (
|
2018-03-15 02:36:54 +01:00
|
|
|
"context"
|
2019-11-13 21:17:45 +01:00
|
|
|
"errors"
|
2017-11-22 21:12:10 +01:00
|
|
|
|
2018-04-06 00:04:40 +02:00
|
|
|
"github.com/minio/minio/cmd/logger"
|
2020-02-05 10:42:34 +01:00
|
|
|
|
|
|
|
bucketsse "github.com/minio/minio/pkg/bucket/encryption"
|
2020-01-27 23:12:34 +01:00
|
|
|
"github.com/minio/minio/pkg/bucket/lifecycle"
|
|
|
|
"github.com/minio/minio/pkg/bucket/object/tagging"
|
|
|
|
"github.com/minio/minio/pkg/bucket/policy"
|
2020-02-05 10:42:34 +01:00
|
|
|
|
2018-01-22 23:54:55 +01:00
|
|
|
"github.com/minio/minio/pkg/madmin"
|
2017-10-22 07:30:34 +02:00
|
|
|
)
|
2017-10-10 01:41:35 +02:00
|
|
|
|
2019-11-20 01:45:35 +01:00
|
|
|
// GatewayLocker implements custom NeNSLock implementation
|
|
|
|
type GatewayLocker struct {
|
|
|
|
ObjectLayer
|
|
|
|
nsMutex *nsLockMap
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewNSLock - implements gateway level locker
|
2020-02-21 06:59:57 +01:00
|
|
|
func (l *GatewayLocker) NewNSLock(ctx context.Context, bucket string, objects ...string) RWLocker {
|
|
|
|
return l.nsMutex.NewNSLock(ctx, nil, bucket, objects...)
|
2019-11-20 01:45:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewGatewayLayerWithLocker - initialize gateway with locker.
|
|
|
|
func NewGatewayLayerWithLocker(gwLayer ObjectLayer) ObjectLayer {
|
|
|
|
return &GatewayLocker{ObjectLayer: gwLayer, nsMutex: newNSLock(false)}
|
|
|
|
}
|
|
|
|
|
2017-12-06 02:58:09 +01:00
|
|
|
// GatewayUnsupported list of unsupported call stubs for gateway.
|
|
|
|
type GatewayUnsupported struct{}
|
2017-10-10 01:41:35 +02:00
|
|
|
|
2020-01-21 23:07:49 +01:00
|
|
|
// CrawlAndGetDataUsage - crawl is not implemented for gateway
|
2020-04-27 19:06:21 +02:00
|
|
|
func (a GatewayUnsupported) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter, updates chan<- DataUsageInfo) error {
|
2020-01-21 23:07:49 +01:00
|
|
|
logger.CriticalIf(ctx, errors.New("not implemented"))
|
2020-03-19 00:19:29 +01:00
|
|
|
return NotImplemented{}
|
2020-01-21 23:07:49 +01:00
|
|
|
}
|
|
|
|
|
2019-11-13 21:17:45 +01:00
|
|
|
// NewNSLock is a dummy stub for gateway.
|
2020-02-21 06:59:57 +01:00
|
|
|
func (a GatewayUnsupported) NewNSLock(ctx context.Context, bucket string, objects ...string) RWLocker {
|
2019-11-13 21:17:45 +01:00
|
|
|
logger.CriticalIf(ctx, errors.New("not implemented"))
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-11-22 21:12:10 +01:00
|
|
|
// ListMultipartUploads lists all multipart uploads.
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) ListMultipartUploads(ctx context.Context, bucket string, prefix string, keyMarker string, uploadIDMarker string, delimiter string, maxUploads int) (lmi ListMultipartsInfo, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return lmi, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// NewMultipartUpload upload object in multiple parts
|
2019-02-09 06:31:06 +01:00
|
|
|
func (a GatewayUnsupported) NewMultipartUpload(ctx context.Context, bucket string, object string, opts ObjectOptions) (uploadID string, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return "", NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
2018-01-22 23:54:55 +01:00
|
|
|
// CopyObjectPart copy part of object to uploadID for another object
|
2018-09-10 18:42:43 +02:00
|
|
|
func (a GatewayUnsupported) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject, uploadID string, partID int, startOffset, length int64, srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (pi PartInfo, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return pi, NotImplemented{}
|
2017-12-06 02:58:09 +01:00
|
|
|
}
|
|
|
|
|
2017-11-22 21:12:10 +01:00
|
|
|
// PutObjectPart puts a part of object in bucket
|
2018-11-15 02:36:41 +01:00
|
|
|
func (a GatewayUnsupported) PutObjectPart(ctx context.Context, bucket string, object string, uploadID string, partID int, data *PutObjReader, opts ObjectOptions) (pi PartInfo, err error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2018-04-06 00:04:40 +02:00
|
|
|
return pi, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ListObjectParts returns all object parts for specified object in specified bucket
|
2019-01-05 23:16:43 +01:00
|
|
|
func (a GatewayUnsupported) ListObjectParts(ctx context.Context, bucket string, object string, uploadID string, partNumberMarker int, maxParts int, opts ObjectOptions) (lpi ListPartsInfo, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return lpi, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// AbortMultipartUpload aborts a ongoing multipart upload
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) AbortMultipartUpload(ctx context.Context, bucket string, object string, uploadID string) error {
|
2018-04-06 00:04:40 +02:00
|
|
|
return NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// CompleteMultipartUpload completes ongoing multipart upload and finalizes object
|
2018-11-15 02:36:41 +01:00
|
|
|
func (a GatewayUnsupported) CompleteMultipartUpload(ctx context.Context, bucket string, object string, uploadID string, uploadedParts []CompletePart, opts ObjectOptions) (oi ObjectInfo, err error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
2018-04-06 00:04:40 +02:00
|
|
|
return oi, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
2018-02-10 00:19:30 +01:00
|
|
|
// SetBucketPolicy sets policy on bucket
|
2018-04-25 00:53:30 +02:00
|
|
|
func (a GatewayUnsupported) SetBucketPolicy(ctx context.Context, bucket string, bucketPolicy *policy.Policy) error {
|
2018-04-06 00:04:40 +02:00
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
2018-02-10 00:19:30 +01:00
|
|
|
// GetBucketPolicy will get policy on bucket
|
2018-04-25 00:53:30 +02:00
|
|
|
func (a GatewayUnsupported) GetBucketPolicy(ctx context.Context, bucket string) (bucketPolicy *policy.Policy, err error) {
|
|
|
|
return nil, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
2018-02-10 00:19:30 +01:00
|
|
|
// DeleteBucketPolicy deletes all policies on bucket
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) DeleteBucketPolicy(ctx context.Context, bucket string) error {
|
2018-04-06 00:04:40 +02:00
|
|
|
return NotImplemented{}
|
2017-11-25 20:58:29 +01:00
|
|
|
}
|
|
|
|
|
2019-07-19 22:20:33 +02:00
|
|
|
// SetBucketLifecycle sets lifecycle on bucket
|
|
|
|
func (a GatewayUnsupported) SetBucketLifecycle(ctx context.Context, bucket string, lifecycle *lifecycle.Lifecycle) error {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetBucketLifecycle will get lifecycle on bucket
|
|
|
|
func (a GatewayUnsupported) GetBucketLifecycle(ctx context.Context, bucket string) (*lifecycle.Lifecycle, error) {
|
|
|
|
return nil, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteBucketLifecycle deletes all lifecycle on bucket
|
|
|
|
func (a GatewayUnsupported) DeleteBucketLifecycle(ctx context.Context, bucket string) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-02-05 10:42:34 +01:00
|
|
|
// GetBucketSSEConfig returns bucket encryption config on given bucket
|
|
|
|
func (a GatewayUnsupported) GetBucketSSEConfig(ctx context.Context, bucket string) (*bucketsse.BucketSSEConfig, error) {
|
|
|
|
return nil, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetBucketSSEConfig sets bucket encryption config on given bucket
|
|
|
|
func (a GatewayUnsupported) SetBucketSSEConfig(ctx context.Context, bucket string, config *bucketsse.BucketSSEConfig) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteBucketSSEConfig deletes bucket encryption config on given bucket
|
|
|
|
func (a GatewayUnsupported) DeleteBucketSSEConfig(ctx context.Context, bucket string) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2018-04-09 19:25:41 +02:00
|
|
|
// ReloadFormat - Not implemented stub.
|
|
|
|
func (a GatewayUnsupported) ReloadFormat(ctx context.Context, dryRun bool) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2018-02-16 02:45:57 +01:00
|
|
|
// HealFormat - Not implemented stub
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) HealFormat(ctx context.Context, dryRun bool) (madmin.HealResultItem, error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return madmin.HealResultItem{}, NotImplemented{}
|
2018-02-16 02:45:57 +01:00
|
|
|
}
|
|
|
|
|
2017-12-06 02:58:09 +01:00
|
|
|
// HealBucket - Not implemented stub
|
2019-02-11 04:53:13 +01:00
|
|
|
func (a GatewayUnsupported) HealBucket(ctx context.Context, bucket string, dryRun, remove bool) (madmin.HealResultItem, error) {
|
|
|
|
return madmin.HealResultItem{}, NotImplemented{}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|
|
|
|
|
2017-12-06 02:58:09 +01:00
|
|
|
// ListBucketsHeal - Not implemented stub
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) ListBucketsHeal(ctx context.Context) (buckets []BucketInfo, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return nil, NotImplemented{}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|
|
|
|
|
2017-12-06 02:58:09 +01:00
|
|
|
// HealObject - Not implemented stub
|
2020-03-19 01:50:00 +01:00
|
|
|
func (a GatewayUnsupported) HealObject(ctx context.Context, bucket, object string, opts madmin.HealOpts) (h madmin.HealResultItem, e error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return h, NotImplemented{}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|
|
|
|
|
2017-12-06 02:58:09 +01:00
|
|
|
// ListObjectsV2 - Not implemented stub
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (result ListObjectsV2Info, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return result, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
|
|
|
|
2020-02-25 16:52:28 +01:00
|
|
|
// Walk - Not implemented stub
|
|
|
|
func (a GatewayUnsupported) Walk(ctx context.Context, bucket, prefix string, results chan<- ObjectInfo) error {
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2019-03-14 01:35:09 +01:00
|
|
|
// HealObjects - Not implemented stub
|
2020-03-19 01:50:00 +01:00
|
|
|
func (a GatewayUnsupported) HealObjects(ctx context.Context, bucket, prefix string, opts madmin.HealOpts, fn healObjectFn) (e error) {
|
2019-03-14 01:35:09 +01:00
|
|
|
return NotImplemented{}
|
2017-03-16 20:21:58 +01:00
|
|
|
}
|
|
|
|
|
2017-11-22 21:12:10 +01:00
|
|
|
// CopyObject copies a blob from source container to destination container.
|
2018-03-15 02:36:54 +01:00
|
|
|
func (a GatewayUnsupported) CopyObject(ctx context.Context, srcBucket string, srcObject string, destBucket string, destObject string,
|
2018-09-10 18:42:43 +02:00
|
|
|
srcInfo ObjectInfo, srcOpts, dstOpts ObjectOptions) (objInfo ObjectInfo, err error) {
|
2018-04-06 00:04:40 +02:00
|
|
|
return objInfo, NotImplemented{}
|
2017-11-22 21:12:10 +01:00
|
|
|
}
|
2018-01-13 05:34:52 +01:00
|
|
|
|
2019-12-06 08:16:06 +01:00
|
|
|
// GetMetrics - no op
|
|
|
|
func (a GatewayUnsupported) GetMetrics(ctx context.Context) (*Metrics, error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return &Metrics{}, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2020-01-20 17:45:59 +01:00
|
|
|
// PutObjectTag - not implemented.
|
|
|
|
func (a GatewayUnsupported) PutObjectTag(ctx context.Context, bucket, object string, tags string) error {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetObjectTag - not implemented.
|
|
|
|
func (a GatewayUnsupported) GetObjectTag(ctx context.Context, bucket, object string) (tagging.Tagging, error) {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return tagging.Tagging{}, NotImplemented{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteObjectTag - not implemented.
|
|
|
|
func (a GatewayUnsupported) DeleteObjectTag(ctx context.Context, bucket, object string) error {
|
|
|
|
logger.LogIf(ctx, NotImplemented{})
|
|
|
|
return NotImplemented{}
|
|
|
|
}
|
|
|
|
|
2018-02-10 00:19:30 +01:00
|
|
|
// IsNotificationSupported returns whether bucket notification is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsNotificationSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2018-12-05 23:03:42 +01:00
|
|
|
// IsListenBucketSupported returns whether listen bucket notification is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsListenBucketSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-01-05 23:16:43 +01:00
|
|
|
// IsEncryptionSupported returns whether server side encryption is implemented for this layer.
|
2018-02-10 00:19:30 +01:00
|
|
|
func (a GatewayUnsupported) IsEncryptionSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
2018-09-28 05:36:17 +02:00
|
|
|
|
|
|
|
// IsCompressionSupported returns whether compression is applicable for this layer.
|
|
|
|
func (a GatewayUnsupported) IsCompressionSupported() bool {
|
|
|
|
return false
|
|
|
|
}
|
2019-12-28 17:54:43 +01:00
|
|
|
|
|
|
|
// IsReady - No Op.
|
|
|
|
func (a GatewayUnsupported) IsReady(_ context.Context) bool {
|
|
|
|
return false
|
|
|
|
}
|