From 26dbf788ad4262487e437e7e23bb3c94e25efc32 Mon Sep 17 00:00:00 2001 From: Egon Elbre Date: Tue, 11 Dec 2018 10:46:52 +0200 Subject: [PATCH] Optimize compilation by removing logging tests (#816) --- pkg/miniogw/config.go | 3 +- pkg/miniogw/{gateway-storj.go => gateway.go} | 0 ...{gateway-storj_test.go => gateway_test.go} | 0 pkg/miniogw/integration_test.go | 13 +- pkg/miniogw/logging.go | 208 ++++++++ pkg/miniogw/logging/gw_mock_test.go | 76 --- pkg/miniogw/logging/logger_mock_test.go | 63 --- pkg/miniogw/logging/logging.go | 261 ---------- pkg/miniogw/logging/objlayer_mock_test.go | 460 ------------------ pkg/miniogw/objstore_mock_test.go | 110 ----- 10 files changed, 216 insertions(+), 978 deletions(-) rename pkg/miniogw/{gateway-storj.go => gateway.go} (100%) rename pkg/miniogw/{gateway-storj_test.go => gateway_test.go} (100%) create mode 100644 pkg/miniogw/logging.go delete mode 100644 pkg/miniogw/logging/gw_mock_test.go delete mode 100644 pkg/miniogw/logging/logger_mock_test.go delete mode 100644 pkg/miniogw/logging/logging.go delete mode 100644 pkg/miniogw/logging/objlayer_mock_test.go delete mode 100644 pkg/miniogw/objstore_mock_test.go diff --git a/pkg/miniogw/config.go b/pkg/miniogw/config.go index 1e80e4003..f3aa3ce9d 100644 --- a/pkg/miniogw/config.go +++ b/pkg/miniogw/config.go @@ -14,7 +14,6 @@ import ( "storj.io/storj/pkg/eestream" "storj.io/storj/pkg/metainfo/kvmetainfo" - "storj.io/storj/pkg/miniogw/logging" "storj.io/storj/pkg/overlay" "storj.io/storj/pkg/pointerdb/pdbclient" "storj.io/storj/pkg/provider" @@ -119,7 +118,7 @@ func (c Config) action(ctx context.Context, cliCtx *cli.Context, identity *provi return err } - minio.StartGateway(cliCtx, logging.Gateway(gw, zap.L())) + minio.StartGateway(cliCtx, Logging(gw, zap.L())) return Error.New("unexpected minio exit") } diff --git a/pkg/miniogw/gateway-storj.go b/pkg/miniogw/gateway.go similarity index 100% rename from pkg/miniogw/gateway-storj.go rename to pkg/miniogw/gateway.go diff --git a/pkg/miniogw/gateway-storj_test.go b/pkg/miniogw/gateway_test.go similarity index 100% rename from pkg/miniogw/gateway-storj_test.go rename to pkg/miniogw/gateway_test.go diff --git a/pkg/miniogw/integration_test.go b/pkg/miniogw/integration_test.go index eb8a5c73c..b8a13538f 100644 --- a/pkg/miniogw/integration_test.go +++ b/pkg/miniogw/integration_test.go @@ -1,10 +1,11 @@ // Copyright (C) 2018 Storj Labs, Inc. // See LICENSE for copying information. -package miniogw +package miniogw_test import ( "context" + "errors" "flag" "os" "testing" @@ -21,7 +22,7 @@ import ( "storj.io/storj/internal/testcontext" "storj.io/storj/internal/testplanet" "storj.io/storj/pkg/cfgstruct" - "storj.io/storj/pkg/miniogw/logging" + "storj.io/storj/pkg/miniogw" "storj.io/storj/pkg/provider" ) @@ -38,7 +39,7 @@ func TestUploadDownload(t *testing.T) { assert.NoError(t, err) // bind default values to config - var gwCfg Config + var gwCfg miniogw.Config cfgstruct.Bind(&flag.FlagSet{}, &gwCfg) // minio config directory @@ -116,7 +117,7 @@ func TestUploadDownload(t *testing.T) { } // runGateway creates and starts a gateway -func runGateway(ctx context.Context, c Config, log *zap.Logger, identity *provider.FullIdentity) (err error) { +func runGateway(ctx context.Context, c miniogw.Config, log *zap.Logger, identity *provider.FullIdentity) (err error) { // set gateway flags flags := flag.NewFlagSet("gateway", flag.ExitOnError) @@ -148,6 +149,6 @@ func runGateway(ctx context.Context, c Config, log *zap.Logger, identity *provid return err } - minio.StartGateway(cliCtx, logging.Gateway(gw, log)) - return Error.New("unexpected minio exit") + minio.StartGateway(cliCtx, miniogw.Logging(gw, log)) + return errors.New("unexpected minio exit") } diff --git a/pkg/miniogw/logging.go b/pkg/miniogw/logging.go new file mode 100644 index 000000000..ec9fd0e23 --- /dev/null +++ b/pkg/miniogw/logging.go @@ -0,0 +1,208 @@ +// Copyright (C) 2018 Storj Labs, Inc. +// See LICENSE for copying information. + +package miniogw + +import ( + "context" + "io" + "reflect" + "time" + + minio "github.com/minio/minio/cmd" + "github.com/minio/minio/pkg/auth" + "github.com/minio/minio/pkg/hash" + "github.com/minio/minio/pkg/madmin" + "github.com/minio/minio/pkg/policy" + "go.uber.org/zap" +) + +type gatewayLogging struct { + gateway minio.Gateway + log *zap.Logger +} + +// Logging returns a wrapper of minio.Gateway that logs errors before returning them. +func Logging(gateway minio.Gateway, log *zap.Logger) minio.Gateway { + return &gatewayLogging{gateway, log} +} + +func (lg *gatewayLogging) Name() string { return lg.gateway.Name() } +func (lg *gatewayLogging) Production() bool { return lg.gateway.Production() } +func (lg *gatewayLogging) NewGatewayLayer(creds auth.Credentials) (minio.ObjectLayer, error) { + layer, err := lg.gateway.NewGatewayLayer(creds) + return &layerLogging{layer: layer, logger: lg.log}, err +} + +type layerLogging struct { + layer minio.ObjectLayer + logger *zap.Logger +} + +// minioError checks if the given error is a minio error. +func minioError(err error) bool { + return reflect.TypeOf(err).ConvertibleTo(reflect.TypeOf(minio.GenericError{})) +} + +// log unexpected errors, i.e. non-minio errors. It will return the given error +// to allow method chaining. +func (log *layerLogging) log(err error) error { + if err != nil && !minioError(err) { + log.logger.Error("gateway error:", zap.Error(err)) + } + return err +} + +func (log *layerLogging) Shutdown(ctx context.Context) error { + return log.log(log.layer.Shutdown(ctx)) +} + +func (log *layerLogging) StorageInfo(ctx context.Context) minio.StorageInfo { + return log.layer.StorageInfo(ctx) +} + +func (log *layerLogging) MakeBucketWithLocation(ctx context.Context, bucket string, location string) error { + return log.log(log.layer.MakeBucketWithLocation(ctx, bucket, location)) +} + +func (log *layerLogging) GetBucketInfo(ctx context.Context, bucket string) (bucketInfo minio.BucketInfo, err error) { + bucketInfo, err = log.layer.GetBucketInfo(ctx, bucket) + return bucketInfo, log.log(err) +} + +func (log *layerLogging) ListBuckets(ctx context.Context) (buckets []minio.BucketInfo, err error) { + buckets, err = log.layer.ListBuckets(ctx) + return buckets, log.log(err) +} + +func (log *layerLogging) DeleteBucket(ctx context.Context, bucket string) error { + return log.log(log.layer.DeleteBucket(ctx, bucket)) +} + +func (log *layerLogging) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (result minio.ListObjectsInfo, err error) { + result, err = log.layer.ListObjects(ctx, bucket, prefix, marker, delimiter, + maxKeys) + return result, log.log(err) +} + +func (log *layerLogging) ListObjectsV2(ctx context.Context, bucket, prefix, continuationToken, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (result minio.ListObjectsV2Info, err error) { + result, err = log.layer.ListObjectsV2(ctx, bucket, prefix, continuationToken, delimiter, maxKeys, fetchOwner, startAfter) + return result, log.log(err) +} + +func (log *layerLogging) GetObject(ctx context.Context, bucket, object string, startOffset int64, length int64, writer io.Writer, etag string) (err error) { + return log.log(log.layer.GetObject(ctx, bucket, object, startOffset, length, writer, etag)) +} + +func (log *layerLogging) GetObjectInfo(ctx context.Context, bucket, object string) (objInfo minio.ObjectInfo, err error) { + objInfo, err = log.layer.GetObjectInfo(ctx, bucket, object) + return objInfo, log.log(err) +} + +func (log *layerLogging) PutObject(ctx context.Context, bucket, object string, data *hash.Reader, metadata map[string]string) (objInfo minio.ObjectInfo, err error) { + objInfo, err = log.layer.PutObject(ctx, bucket, object, data, metadata) + return objInfo, log.log(err) +} + +func (log *layerLogging) CopyObject(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, srcInfo minio.ObjectInfo) (objInfo minio.ObjectInfo, err error) { + objInfo, err = log.layer.CopyObject(ctx, srcBucket, srcObject, destBucket, destObject, srcInfo) + return objInfo, log.log(err) +} + +func (log *layerLogging) DeleteObject(ctx context.Context, bucket, object string) (err error) { + return log.log(log.layer.DeleteObject(ctx, bucket, object)) +} + +func (log *layerLogging) ListMultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result minio.ListMultipartsInfo, err error) { + result, err = log.layer.ListMultipartUploads(ctx, bucket, prefix, keyMarker, uploadIDMarker, delimiter, maxUploads) + return result, log.log(err) +} + +func (log *layerLogging) NewMultipartUpload(ctx context.Context, bucket, object string, metadata map[string]string) (uploadID string, err error) { + uploadID, err = log.layer.NewMultipartUpload(ctx, bucket, object, metadata) + return uploadID, log.log(err) +} + +func (log *layerLogging) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string, partID int, startOffset int64, length int64, srcInfo minio.ObjectInfo) (info minio.PartInfo, err error) { + info, err = log.layer.CopyObjectPart(ctx, srcBucket, srcObject, destBucket, destObject, uploadID, partID, startOffset, length, srcInfo) + return info, log.log(err) +} + +func (log *layerLogging) PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int, data *hash.Reader) (info minio.PartInfo, err error) { + info, err = log.layer.PutObjectPart(ctx, bucket, object, uploadID, partID, data) + return info, log.log(err) +} + +func (log *layerLogging) ListObjectParts(ctx context.Context, bucket, object, uploadID string, partNumberMarker int, maxParts int) (result minio.ListPartsInfo, err error) { + result, err = log.layer.ListObjectParts(ctx, bucket, object, uploadID, + partNumberMarker, maxParts) + return result, log.log(err) +} + +func (log *layerLogging) AbortMultipartUpload(ctx context.Context, bucket, object, uploadID string) error { + return log.log(log.layer.AbortMultipartUpload(ctx, bucket, object, uploadID)) +} + +func (log *layerLogging) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, uploadedParts []minio.CompletePart) (objInfo minio.ObjectInfo, err error) { + objInfo, err = log.layer.CompleteMultipartUpload(ctx, bucket, object, uploadID, uploadedParts) + return objInfo, log.log(err) +} + +func (log *layerLogging) ReloadFormat(ctx context.Context, dryRun bool) error { + return log.log(log.layer.ReloadFormat(ctx, dryRun)) +} + +func (log *layerLogging) HealFormat(ctx context.Context, dryRun bool) (madmin.HealResultItem, error) { + rv, err := log.layer.HealFormat(ctx, dryRun) + return rv, log.log(err) +} + +func (log *layerLogging) HealBucket(ctx context.Context, bucket string, dryRun bool) ([]madmin.HealResultItem, error) { + rv, err := log.layer.HealBucket(ctx, bucket, dryRun) + return rv, log.log(err) +} + +func (log *layerLogging) HealObject(ctx context.Context, bucket, object string, dryRun bool) (madmin.HealResultItem, error) { + rv, err := log.layer.HealObject(ctx, bucket, object, dryRun) + return rv, log.log(err) +} + +func (log *layerLogging) ListBucketsHeal(ctx context.Context) (buckets []minio.BucketInfo, err error) { + buckets, err = log.layer.ListBucketsHeal(ctx) + return buckets, log.log(err) +} + +func (log *layerLogging) ListObjectsHeal(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (minio.ListObjectsInfo, error) { + rv, err := log.layer.ListObjectsHeal(ctx, bucket, prefix, marker, delimiter, maxKeys) + return rv, log.log(err) +} + +func (log *layerLogging) ListLocks(ctx context.Context, bucket, prefix string, duration time.Duration) ([]minio.VolumeLockInfo, error) { + rv, err := log.layer.ListLocks(ctx, bucket, prefix, duration) + return rv, log.log(err) +} + +func (log *layerLogging) ClearLocks(ctx context.Context, lockInfos []minio.VolumeLockInfo) error { + return log.log(log.layer.ClearLocks(ctx, lockInfos)) +} + +func (log *layerLogging) SetBucketPolicy(ctx context.Context, n string, p *policy.Policy) error { + return log.log(log.layer.SetBucketPolicy(ctx, n, p)) +} + +func (log *layerLogging) GetBucketPolicy(ctx context.Context, n string) (*policy.Policy, error) { + p, err := log.layer.GetBucketPolicy(ctx, n) + return p, log.log(err) +} + +func (log *layerLogging) DeleteBucketPolicy(ctx context.Context, n string) error { + return log.log(log.layer.DeleteBucketPolicy(ctx, n)) +} + +func (log *layerLogging) IsNotificationSupported() bool { + return log.layer.IsNotificationSupported() +} + +func (log *layerLogging) IsEncryptionSupported() bool { + return log.layer.IsEncryptionSupported() +} diff --git a/pkg/miniogw/logging/gw_mock_test.go b/pkg/miniogw/logging/gw_mock_test.go deleted file mode 100644 index 6cb3ee7cc..000000000 --- a/pkg/miniogw/logging/gw_mock_test.go +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2018 Storj Labs, Inc. -// See LICENSE for copying information. - -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/minio/minio/cmd (interfaces: Gateway) - -// Package logging is a generated GoMock package. -package logging - -import ( - reflect "reflect" - - gomock "github.com/golang/mock/gomock" - cmd "github.com/minio/minio/cmd" - auth "github.com/minio/minio/pkg/auth" -) - -// MockGateway is a mock of Gateway interface -type MockGateway struct { - ctrl *gomock.Controller - recorder *MockGatewayMockRecorder -} - -// MockGatewayMockRecorder is the mock recorder for MockGateway -type MockGatewayMockRecorder struct { - mock *MockGateway -} - -// NewMockGateway creates a new mock instance -func NewMockGateway(ctrl *gomock.Controller) *MockGateway { - mock := &MockGateway{ctrl: ctrl} - mock.recorder = &MockGatewayMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockGateway) EXPECT() *MockGatewayMockRecorder { - return m.recorder -} - -// Name mocks base method -func (m *MockGateway) Name() string { - ret := m.ctrl.Call(m, "Name") - ret0, _ := ret[0].(string) - return ret0 -} - -// Name indicates an expected call of Name -func (mr *MockGatewayMockRecorder) Name() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockGateway)(nil).Name)) -} - -// NewGatewayLayer mocks base method -func (m *MockGateway) NewGatewayLayer(arg0 auth.Credentials) (cmd.ObjectLayer, error) { - ret := m.ctrl.Call(m, "NewGatewayLayer", arg0) - ret0, _ := ret[0].(cmd.ObjectLayer) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewGatewayLayer indicates an expected call of NewGatewayLayer -func (mr *MockGatewayMockRecorder) NewGatewayLayer(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewGatewayLayer", reflect.TypeOf((*MockGateway)(nil).NewGatewayLayer), arg0) -} - -// Production mocks base method -func (m *MockGateway) Production() bool { - ret := m.ctrl.Call(m, "Production") - ret0, _ := ret[0].(bool) - return ret0 -} - -// Production indicates an expected call of Production -func (mr *MockGatewayMockRecorder) Production() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Production", reflect.TypeOf((*MockGateway)(nil).Production)) -} diff --git a/pkg/miniogw/logging/logger_mock_test.go b/pkg/miniogw/logging/logger_mock_test.go deleted file mode 100644 index 0891f5087..000000000 --- a/pkg/miniogw/logging/logger_mock_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// Code generated by MockGen. DO NOT EDIT. -// Source: storj.io/storj/pkg/miniogw/logging (interfaces: ErrorLogger) - -// Package logging is a generated GoMock package. -package logging - -import ( - gomock "github.com/golang/mock/gomock" - reflect "reflect" -) - -// MockErrorLogger is a mock of ErrorLogger interface -type MockErrorLogger struct { - ctrl *gomock.Controller - recorder *MockErrorLoggerMockRecorder -} - -// MockErrorLoggerMockRecorder is the mock recorder for MockErrorLogger -type MockErrorLoggerMockRecorder struct { - mock *MockErrorLogger -} - -// NewMockErrorLogger creates a new mock instance -func NewMockErrorLogger(ctrl *gomock.Controller) *MockErrorLogger { - mock := &MockErrorLogger{ctrl: ctrl} - mock.recorder = &MockErrorLoggerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockErrorLogger) EXPECT() *MockErrorLoggerMockRecorder { - return m.recorder -} - -// Debugf mocks base method -func (m *MockErrorLogger) Debugf(arg0 string, arg1 ...interface{}) { - varargs := []interface{}{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - m.ctrl.Call(m, "Debugf", varargs...) -} - -// Debugf indicates an expected call of Debugf -func (mr *MockErrorLoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call { - varargs := append([]interface{}{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Debugf", reflect.TypeOf((*MockErrorLogger)(nil).Debugf), varargs...) -} - -// Errorf mocks base method -func (m *MockErrorLogger) Errorf(arg0 string, arg1 ...interface{}) { - varargs := []interface{}{arg0} - for _, a := range arg1 { - varargs = append(varargs, a) - } - m.ctrl.Call(m, "Errorf", varargs...) -} - -// Errorf indicates an expected call of Errorf -func (mr *MockErrorLoggerMockRecorder) Errorf(arg0 interface{}, arg1 ...interface{}) *gomock.Call { - varargs := append([]interface{}{arg0}, arg1...) - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Errorf", reflect.TypeOf((*MockErrorLogger)(nil).Errorf), varargs...) -} diff --git a/pkg/miniogw/logging/logging.go b/pkg/miniogw/logging/logging.go deleted file mode 100644 index 6157daed6..000000000 --- a/pkg/miniogw/logging/logging.go +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (C) 2018 Storj Labs, Inc. -// See LICENSE for copying information. - -package logging - -import ( - context "context" - io "io" - "reflect" - "time" - - minio "github.com/minio/minio/cmd" - "github.com/minio/minio/pkg/auth" - "github.com/minio/minio/pkg/hash" - "github.com/minio/minio/pkg/madmin" - "github.com/minio/minio/pkg/policy" - "go.uber.org/zap" -) - -type gwLogWrap struct { - gw minio.Gateway - log *zap.Logger -} - -// Gateway is a wrapper of minio.Gateway that logs errors before -// returning them. -func Gateway(gw minio.Gateway, log *zap.Logger) minio.Gateway { - return &gwLogWrap{gw, log} -} - -func (lg *gwLogWrap) Name() string { return lg.gw.Name() } -func (lg *gwLogWrap) Production() bool { return lg.gw.Production() } -func (lg *gwLogWrap) NewGatewayLayer(creds auth.Credentials) ( - minio.ObjectLayer, error) { - ol, err := lg.gw.NewGatewayLayer(creds) - return &olLogWrap{ol: ol, logger: lg.log}, err -} - -type olLogWrap struct { - ol minio.ObjectLayer - logger ErrorLogger -} - -// ErrorLogger logs a templated error message. -type ErrorLogger interface { - Error(msg string, fields ...zap.Field) -} - -// minioError checks if the given error is a minio error. -func minioError(err error) bool { - return reflect.TypeOf(err).ConvertibleTo(reflect.TypeOf(minio.GenericError{})) -} - -// log unexpected errors, i.e. non-minio errors. It will return the given error -// to allow method chaining. -func (ol *olLogWrap) log(err error) error { - if err != nil && !minioError(err) { - ol.logger.Error("gateway error:", zap.Error(err)) - } - return err -} - -func (ol *olLogWrap) Shutdown(ctx context.Context) error { - return ol.log(ol.ol.Shutdown(ctx)) -} - -func (ol *olLogWrap) StorageInfo(ctx context.Context) minio.StorageInfo { - return ol.ol.StorageInfo(ctx) -} - -func (ol *olLogWrap) MakeBucketWithLocation(ctx context.Context, - bucket string, location string) error { - return ol.log(ol.ol.MakeBucketWithLocation(ctx, bucket, location)) -} - -func (ol *olLogWrap) GetBucketInfo(ctx context.Context, bucket string) ( - bucketInfo minio.BucketInfo, err error) { - bucketInfo, err = ol.ol.GetBucketInfo(ctx, bucket) - return bucketInfo, ol.log(err) -} - -func (ol *olLogWrap) ListBuckets(ctx context.Context) ( - buckets []minio.BucketInfo, err error) { - buckets, err = ol.ol.ListBuckets(ctx) - return buckets, ol.log(err) -} - -func (ol *olLogWrap) DeleteBucket(ctx context.Context, bucket string) error { - return ol.log(ol.ol.DeleteBucket(ctx, bucket)) -} - -func (ol *olLogWrap) ListObjects(ctx context.Context, - bucket, prefix, marker, delimiter string, maxKeys int) ( - result minio.ListObjectsInfo, err error) { - result, err = ol.ol.ListObjects(ctx, bucket, prefix, marker, delimiter, - maxKeys) - return result, ol.log(err) -} - -func (ol *olLogWrap) ListObjectsV2(ctx context.Context, - bucket, prefix, continuationToken, delimiter string, maxKeys int, - fetchOwner bool, startAfter string) (result minio.ListObjectsV2Info, - err error) { - result, err = ol.ol.ListObjectsV2(ctx, bucket, prefix, continuationToken, - delimiter, maxKeys, fetchOwner, startAfter) - return result, ol.log(err) -} - -func (ol *olLogWrap) GetObject(ctx context.Context, bucket, object string, - startOffset int64, length int64, writer io.Writer, etag string) (err error) { - return ol.log(ol.ol.GetObject(ctx, bucket, object, startOffset, length, - writer, etag)) -} - -func (ol *olLogWrap) GetObjectInfo(ctx context.Context, bucket, object string) ( - objInfo minio.ObjectInfo, err error) { - objInfo, err = ol.ol.GetObjectInfo(ctx, bucket, object) - return objInfo, ol.log(err) -} - -func (ol *olLogWrap) PutObject(ctx context.Context, bucket, object string, - data *hash.Reader, metadata map[string]string) (objInfo minio.ObjectInfo, - err error) { - objInfo, err = ol.ol.PutObject(ctx, bucket, object, data, metadata) - return objInfo, ol.log(err) -} - -func (ol *olLogWrap) CopyObject(ctx context.Context, - srcBucket, srcObject, destBucket, destObject string, - srcInfo minio.ObjectInfo) (objInfo minio.ObjectInfo, err error) { - objInfo, err = ol.ol.CopyObject(ctx, srcBucket, srcObject, destBucket, - destObject, srcInfo) - return objInfo, ol.log(err) -} - -func (ol *olLogWrap) DeleteObject(ctx context.Context, bucket, object string) ( - err error) { - return ol.log(ol.ol.DeleteObject(ctx, bucket, object)) -} - -func (ol *olLogWrap) ListMultipartUploads(ctx context.Context, - bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) ( - result minio.ListMultipartsInfo, err error) { - result, err = ol.ol.ListMultipartUploads(ctx, bucket, prefix, keyMarker, - uploadIDMarker, delimiter, maxUploads) - return result, ol.log(err) -} - -func (ol *olLogWrap) NewMultipartUpload(ctx context.Context, - bucket, object string, metadata map[string]string) (uploadID string, - err error) { - uploadID, err = ol.ol.NewMultipartUpload(ctx, bucket, object, metadata) - return uploadID, ol.log(err) -} - -func (ol *olLogWrap) CopyObjectPart(ctx context.Context, - srcBucket, srcObject, destBucket, destObject string, uploadID string, - partID int, startOffset int64, length int64, srcInfo minio.ObjectInfo) ( - info minio.PartInfo, err error) { - info, err = ol.ol.CopyObjectPart(ctx, srcBucket, srcObject, destBucket, - destObject, uploadID, partID, startOffset, length, srcInfo) - return info, ol.log(err) -} - -func (ol *olLogWrap) PutObjectPart(ctx context.Context, - bucket, object, uploadID string, partID int, data *hash.Reader) ( - info minio.PartInfo, err error) { - info, err = ol.ol.PutObjectPart(ctx, bucket, object, uploadID, partID, data) - return info, ol.log(err) -} - -func (ol *olLogWrap) ListObjectParts(ctx context.Context, - bucket, object, uploadID string, partNumberMarker int, maxParts int) ( - result minio.ListPartsInfo, err error) { - result, err = ol.ol.ListObjectParts(ctx, bucket, object, uploadID, - partNumberMarker, maxParts) - return result, ol.log(err) -} - -func (ol *olLogWrap) AbortMultipartUpload(ctx context.Context, - bucket, object, uploadID string) error { - return ol.log(ol.ol.AbortMultipartUpload(ctx, bucket, object, uploadID)) -} - -func (ol *olLogWrap) CompleteMultipartUpload(ctx context.Context, - bucket, object, uploadID string, uploadedParts []minio.CompletePart) ( - objInfo minio.ObjectInfo, err error) { - objInfo, err = ol.ol.CompleteMultipartUpload(ctx, bucket, object, uploadID, - uploadedParts) - return objInfo, ol.log(err) -} - -func (ol *olLogWrap) ReloadFormat(ctx context.Context, dryRun bool) error { - return ol.log(ol.ol.ReloadFormat(ctx, dryRun)) -} - -func (ol *olLogWrap) HealFormat(ctx context.Context, dryRun bool) ( - madmin.HealResultItem, error) { - rv, err := ol.ol.HealFormat(ctx, dryRun) - return rv, ol.log(err) -} - -func (ol *olLogWrap) HealBucket(ctx context.Context, bucket string, - dryRun bool) ([]madmin.HealResultItem, error) { - rv, err := ol.ol.HealBucket(ctx, bucket, dryRun) - return rv, ol.log(err) -} - -func (ol *olLogWrap) HealObject(ctx context.Context, bucket, object string, - dryRun bool) (madmin.HealResultItem, error) { - rv, err := ol.ol.HealObject(ctx, bucket, object, dryRun) - return rv, ol.log(err) -} - -func (ol *olLogWrap) ListBucketsHeal(ctx context.Context) ( - buckets []minio.BucketInfo, err error) { - buckets, err = ol.ol.ListBucketsHeal(ctx) - return buckets, ol.log(err) -} - -func (ol *olLogWrap) ListObjectsHeal(ctx context.Context, - bucket, prefix, marker, delimiter string, maxKeys int) ( - minio.ListObjectsInfo, error) { - rv, err := ol.ol.ListObjectsHeal(ctx, bucket, prefix, marker, delimiter, - maxKeys) - return rv, ol.log(err) -} - -func (ol *olLogWrap) ListLocks(ctx context.Context, bucket, prefix string, - duration time.Duration) ([]minio.VolumeLockInfo, error) { - rv, err := ol.ol.ListLocks(ctx, bucket, prefix, duration) - return rv, ol.log(err) -} - -func (ol *olLogWrap) ClearLocks(ctx context.Context, - lockInfos []minio.VolumeLockInfo) error { - return ol.log(ol.ol.ClearLocks(ctx, lockInfos)) -} - -func (ol *olLogWrap) SetBucketPolicy(ctx context.Context, n string, - p *policy.Policy) error { - return ol.log(ol.ol.SetBucketPolicy(ctx, n, p)) -} - -func (ol *olLogWrap) GetBucketPolicy(ctx context.Context, n string) ( - *policy.Policy, error) { - p, err := ol.ol.GetBucketPolicy(ctx, n) - return p, ol.log(err) -} - -func (ol *olLogWrap) DeleteBucketPolicy(ctx context.Context, n string) error { - return ol.log(ol.ol.DeleteBucketPolicy(ctx, n)) -} - -func (ol *olLogWrap) IsNotificationSupported() bool { - return ol.ol.IsNotificationSupported() -} - -func (ol *olLogWrap) IsEncryptionSupported() bool { - return ol.ol.IsEncryptionSupported() -} diff --git a/pkg/miniogw/logging/objlayer_mock_test.go b/pkg/miniogw/logging/objlayer_mock_test.go deleted file mode 100644 index bf4d830e6..000000000 --- a/pkg/miniogw/logging/objlayer_mock_test.go +++ /dev/null @@ -1,460 +0,0 @@ -// Copyright (C) 2018 Storj Labs, Inc. -// See LICENSE for copying information. - -// Code generated by MockGen. DO NOT EDIT. -// Source: github.com/minio/minio/cmd (interfaces: ObjectLayer) - -// Package logging is a generated GoMock package. -package logging - -import ( - context "context" - io "io" - reflect "reflect" - time "time" - - gomock "github.com/golang/mock/gomock" - cmd "github.com/minio/minio/cmd" - hash "github.com/minio/minio/pkg/hash" - madmin "github.com/minio/minio/pkg/madmin" - policy "github.com/minio/minio/pkg/policy" -) - -// MockObjectLayer is a mock of ObjectLayer interface -type MockObjectLayer struct { - ctrl *gomock.Controller - recorder *MockObjectLayerMockRecorder -} - -// MockObjectLayerMockRecorder is the mock recorder for MockObjectLayer -type MockObjectLayerMockRecorder struct { - mock *MockObjectLayer -} - -// NewMockObjectLayer creates a new mock instance -func NewMockObjectLayer(ctrl *gomock.Controller) *MockObjectLayer { - mock := &MockObjectLayer{ctrl: ctrl} - mock.recorder = &MockObjectLayerMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockObjectLayer) EXPECT() *MockObjectLayerMockRecorder { - return m.recorder -} - -// AbortMultipartUpload mocks base method -func (m *MockObjectLayer) AbortMultipartUpload(arg0 context.Context, arg1, arg2, arg3 string) error { - ret := m.ctrl.Call(m, "AbortMultipartUpload", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(error) - return ret0 -} - -// AbortMultipartUpload indicates an expected call of AbortMultipartUpload -func (mr *MockObjectLayerMockRecorder) AbortMultipartUpload(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AbortMultipartUpload", reflect.TypeOf((*MockObjectLayer)(nil).AbortMultipartUpload), arg0, arg1, arg2, arg3) -} - -// ClearLocks mocks base method -func (m *MockObjectLayer) ClearLocks(arg0 context.Context, arg1 []cmd.VolumeLockInfo) error { - ret := m.ctrl.Call(m, "ClearLocks", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// ClearLocks indicates an expected call of ClearLocks -func (mr *MockObjectLayerMockRecorder) ClearLocks(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClearLocks", reflect.TypeOf((*MockObjectLayer)(nil).ClearLocks), arg0, arg1) -} - -// CompleteMultipartUpload mocks base method -func (m *MockObjectLayer) CompleteMultipartUpload(arg0 context.Context, arg1, arg2, arg3 string, arg4 []cmd.CompletePart) (cmd.ObjectInfo, error) { - ret := m.ctrl.Call(m, "CompleteMultipartUpload", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(cmd.ObjectInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CompleteMultipartUpload indicates an expected call of CompleteMultipartUpload -func (mr *MockObjectLayerMockRecorder) CompleteMultipartUpload(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CompleteMultipartUpload", reflect.TypeOf((*MockObjectLayer)(nil).CompleteMultipartUpload), arg0, arg1, arg2, arg3, arg4) -} - -// CopyObject mocks base method -func (m *MockObjectLayer) CopyObject(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5 cmd.ObjectInfo) (cmd.ObjectInfo, error) { - ret := m.ctrl.Call(m, "CopyObject", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(cmd.ObjectInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CopyObject indicates an expected call of CopyObject -func (mr *MockObjectLayerMockRecorder) CopyObject(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CopyObject", reflect.TypeOf((*MockObjectLayer)(nil).CopyObject), arg0, arg1, arg2, arg3, arg4, arg5) -} - -// CopyObjectPart mocks base method -func (m *MockObjectLayer) CopyObjectPart(arg0 context.Context, arg1, arg2, arg3, arg4, arg5 string, arg6 int, arg7, arg8 int64, arg9 cmd.ObjectInfo) (cmd.PartInfo, error) { - ret := m.ctrl.Call(m, "CopyObjectPart", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) - ret0, _ := ret[0].(cmd.PartInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// CopyObjectPart indicates an expected call of CopyObjectPart -func (mr *MockObjectLayerMockRecorder) CopyObjectPart(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CopyObjectPart", reflect.TypeOf((*MockObjectLayer)(nil).CopyObjectPart), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) -} - -// DeleteBucket mocks base method -func (m *MockObjectLayer) DeleteBucket(arg0 context.Context, arg1 string) error { - ret := m.ctrl.Call(m, "DeleteBucket", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteBucket indicates an expected call of DeleteBucket -func (mr *MockObjectLayerMockRecorder) DeleteBucket(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBucket", reflect.TypeOf((*MockObjectLayer)(nil).DeleteBucket), arg0, arg1) -} - -// DeleteBucketPolicy mocks base method -func (m *MockObjectLayer) DeleteBucketPolicy(arg0 context.Context, arg1 string) error { - ret := m.ctrl.Call(m, "DeleteBucketPolicy", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteBucketPolicy indicates an expected call of DeleteBucketPolicy -func (mr *MockObjectLayerMockRecorder) DeleteBucketPolicy(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBucketPolicy", reflect.TypeOf((*MockObjectLayer)(nil).DeleteBucketPolicy), arg0, arg1) -} - -// DeleteObject mocks base method -func (m *MockObjectLayer) DeleteObject(arg0 context.Context, arg1, arg2 string) error { - ret := m.ctrl.Call(m, "DeleteObject", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// DeleteObject indicates an expected call of DeleteObject -func (mr *MockObjectLayerMockRecorder) DeleteObject(arg0, arg1, arg2 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteObject", reflect.TypeOf((*MockObjectLayer)(nil).DeleteObject), arg0, arg1, arg2) -} - -// GetBucketInfo mocks base method -func (m *MockObjectLayer) GetBucketInfo(arg0 context.Context, arg1 string) (cmd.BucketInfo, error) { - ret := m.ctrl.Call(m, "GetBucketInfo", arg0, arg1) - ret0, _ := ret[0].(cmd.BucketInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBucketInfo indicates an expected call of GetBucketInfo -func (mr *MockObjectLayerMockRecorder) GetBucketInfo(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBucketInfo", reflect.TypeOf((*MockObjectLayer)(nil).GetBucketInfo), arg0, arg1) -} - -// GetBucketPolicy mocks base method -func (m *MockObjectLayer) GetBucketPolicy(arg0 context.Context, arg1 string) (*policy.Policy, error) { - ret := m.ctrl.Call(m, "GetBucketPolicy", arg0, arg1) - ret0, _ := ret[0].(*policy.Policy) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetBucketPolicy indicates an expected call of GetBucketPolicy -func (mr *MockObjectLayerMockRecorder) GetBucketPolicy(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBucketPolicy", reflect.TypeOf((*MockObjectLayer)(nil).GetBucketPolicy), arg0, arg1) -} - -// GetObject mocks base method -func (m *MockObjectLayer) GetObject(arg0 context.Context, arg1, arg2 string, arg3, arg4 int64, arg5 io.Writer, arg6 string) error { - ret := m.ctrl.Call(m, "GetObject", arg0, arg1, arg2, arg3, arg4, arg5, arg6) - ret0, _ := ret[0].(error) - return ret0 -} - -// GetObject indicates an expected call of GetObject -func (mr *MockObjectLayerMockRecorder) GetObject(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObject", reflect.TypeOf((*MockObjectLayer)(nil).GetObject), arg0, arg1, arg2, arg3, arg4, arg5, arg6) -} - -// GetObjectInfo mocks base method -func (m *MockObjectLayer) GetObjectInfo(arg0 context.Context, arg1, arg2 string) (cmd.ObjectInfo, error) { - ret := m.ctrl.Call(m, "GetObjectInfo", arg0, arg1, arg2) - ret0, _ := ret[0].(cmd.ObjectInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// GetObjectInfo indicates an expected call of GetObjectInfo -func (mr *MockObjectLayerMockRecorder) GetObjectInfo(arg0, arg1, arg2 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetObjectInfo", reflect.TypeOf((*MockObjectLayer)(nil).GetObjectInfo), arg0, arg1, arg2) -} - -// HealBucket mocks base method -func (m *MockObjectLayer) HealBucket(arg0 context.Context, arg1 string, arg2 bool) ([]madmin.HealResultItem, error) { - ret := m.ctrl.Call(m, "HealBucket", arg0, arg1, arg2) - ret0, _ := ret[0].([]madmin.HealResultItem) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HealBucket indicates an expected call of HealBucket -func (mr *MockObjectLayerMockRecorder) HealBucket(arg0, arg1, arg2 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HealBucket", reflect.TypeOf((*MockObjectLayer)(nil).HealBucket), arg0, arg1, arg2) -} - -// HealFormat mocks base method -func (m *MockObjectLayer) HealFormat(arg0 context.Context, arg1 bool) (madmin.HealResultItem, error) { - ret := m.ctrl.Call(m, "HealFormat", arg0, arg1) - ret0, _ := ret[0].(madmin.HealResultItem) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HealFormat indicates an expected call of HealFormat -func (mr *MockObjectLayerMockRecorder) HealFormat(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HealFormat", reflect.TypeOf((*MockObjectLayer)(nil).HealFormat), arg0, arg1) -} - -// HealObject mocks base method -func (m *MockObjectLayer) HealObject(arg0 context.Context, arg1, arg2 string, arg3 bool) (madmin.HealResultItem, error) { - ret := m.ctrl.Call(m, "HealObject", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(madmin.HealResultItem) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// HealObject indicates an expected call of HealObject -func (mr *MockObjectLayerMockRecorder) HealObject(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HealObject", reflect.TypeOf((*MockObjectLayer)(nil).HealObject), arg0, arg1, arg2, arg3) -} - -// IsEncryptionSupported mocks base method -func (m *MockObjectLayer) IsEncryptionSupported() bool { - ret := m.ctrl.Call(m, "IsEncryptionSupported") - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsEncryptionSupported indicates an expected call of IsEncryptionSupported -func (mr *MockObjectLayerMockRecorder) IsEncryptionSupported() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsEncryptionSupported", reflect.TypeOf((*MockObjectLayer)(nil).IsEncryptionSupported)) -} - -// IsNotificationSupported mocks base method -func (m *MockObjectLayer) IsNotificationSupported() bool { - ret := m.ctrl.Call(m, "IsNotificationSupported") - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsNotificationSupported indicates an expected call of IsNotificationSupported -func (mr *MockObjectLayerMockRecorder) IsNotificationSupported() *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsNotificationSupported", reflect.TypeOf((*MockObjectLayer)(nil).IsNotificationSupported)) -} - -// ListBuckets mocks base method -func (m *MockObjectLayer) ListBuckets(arg0 context.Context) ([]cmd.BucketInfo, error) { - ret := m.ctrl.Call(m, "ListBuckets", arg0) - ret0, _ := ret[0].([]cmd.BucketInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListBuckets indicates an expected call of ListBuckets -func (mr *MockObjectLayerMockRecorder) ListBuckets(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBuckets", reflect.TypeOf((*MockObjectLayer)(nil).ListBuckets), arg0) -} - -// ListBucketsHeal mocks base method -func (m *MockObjectLayer) ListBucketsHeal(arg0 context.Context) ([]cmd.BucketInfo, error) { - ret := m.ctrl.Call(m, "ListBucketsHeal", arg0) - ret0, _ := ret[0].([]cmd.BucketInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListBucketsHeal indicates an expected call of ListBucketsHeal -func (mr *MockObjectLayerMockRecorder) ListBucketsHeal(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListBucketsHeal", reflect.TypeOf((*MockObjectLayer)(nil).ListBucketsHeal), arg0) -} - -// ListLocks mocks base method -func (m *MockObjectLayer) ListLocks(arg0 context.Context, arg1, arg2 string, arg3 time.Duration) ([]cmd.VolumeLockInfo, error) { - ret := m.ctrl.Call(m, "ListLocks", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].([]cmd.VolumeLockInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListLocks indicates an expected call of ListLocks -func (mr *MockObjectLayerMockRecorder) ListLocks(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListLocks", reflect.TypeOf((*MockObjectLayer)(nil).ListLocks), arg0, arg1, arg2, arg3) -} - -// ListMultipartUploads mocks base method -func (m *MockObjectLayer) ListMultipartUploads(arg0 context.Context, arg1, arg2, arg3, arg4, arg5 string, arg6 int) (cmd.ListMultipartsInfo, error) { - ret := m.ctrl.Call(m, "ListMultipartUploads", arg0, arg1, arg2, arg3, arg4, arg5, arg6) - ret0, _ := ret[0].(cmd.ListMultipartsInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListMultipartUploads indicates an expected call of ListMultipartUploads -func (mr *MockObjectLayerMockRecorder) ListMultipartUploads(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListMultipartUploads", reflect.TypeOf((*MockObjectLayer)(nil).ListMultipartUploads), arg0, arg1, arg2, arg3, arg4, arg5, arg6) -} - -// ListObjectParts mocks base method -func (m *MockObjectLayer) ListObjectParts(arg0 context.Context, arg1, arg2, arg3 string, arg4, arg5 int) (cmd.ListPartsInfo, error) { - ret := m.ctrl.Call(m, "ListObjectParts", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(cmd.ListPartsInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListObjectParts indicates an expected call of ListObjectParts -func (mr *MockObjectLayerMockRecorder) ListObjectParts(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListObjectParts", reflect.TypeOf((*MockObjectLayer)(nil).ListObjectParts), arg0, arg1, arg2, arg3, arg4, arg5) -} - -// ListObjects mocks base method -func (m *MockObjectLayer) ListObjects(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5 int) (cmd.ListObjectsInfo, error) { - ret := m.ctrl.Call(m, "ListObjects", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(cmd.ListObjectsInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListObjects indicates an expected call of ListObjects -func (mr *MockObjectLayerMockRecorder) ListObjects(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListObjects", reflect.TypeOf((*MockObjectLayer)(nil).ListObjects), arg0, arg1, arg2, arg3, arg4, arg5) -} - -// ListObjectsHeal mocks base method -func (m *MockObjectLayer) ListObjectsHeal(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5 int) (cmd.ListObjectsInfo, error) { - ret := m.ctrl.Call(m, "ListObjectsHeal", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(cmd.ListObjectsInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListObjectsHeal indicates an expected call of ListObjectsHeal -func (mr *MockObjectLayerMockRecorder) ListObjectsHeal(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListObjectsHeal", reflect.TypeOf((*MockObjectLayer)(nil).ListObjectsHeal), arg0, arg1, arg2, arg3, arg4, arg5) -} - -// ListObjectsV2 mocks base method -func (m *MockObjectLayer) ListObjectsV2(arg0 context.Context, arg1, arg2, arg3, arg4 string, arg5 int, arg6 bool, arg7 string) (cmd.ListObjectsV2Info, error) { - ret := m.ctrl.Call(m, "ListObjectsV2", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) - ret0, _ := ret[0].(cmd.ListObjectsV2Info) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// ListObjectsV2 indicates an expected call of ListObjectsV2 -func (mr *MockObjectLayerMockRecorder) ListObjectsV2(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListObjectsV2", reflect.TypeOf((*MockObjectLayer)(nil).ListObjectsV2), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) -} - -// MakeBucketWithLocation mocks base method -func (m *MockObjectLayer) MakeBucketWithLocation(arg0 context.Context, arg1, arg2 string) error { - ret := m.ctrl.Call(m, "MakeBucketWithLocation", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// MakeBucketWithLocation indicates an expected call of MakeBucketWithLocation -func (mr *MockObjectLayerMockRecorder) MakeBucketWithLocation(arg0, arg1, arg2 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeBucketWithLocation", reflect.TypeOf((*MockObjectLayer)(nil).MakeBucketWithLocation), arg0, arg1, arg2) -} - -// NewMultipartUpload mocks base method -func (m *MockObjectLayer) NewMultipartUpload(arg0 context.Context, arg1, arg2 string, arg3 map[string]string) (string, error) { - ret := m.ctrl.Call(m, "NewMultipartUpload", arg0, arg1, arg2, arg3) - ret0, _ := ret[0].(string) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// NewMultipartUpload indicates an expected call of NewMultipartUpload -func (mr *MockObjectLayerMockRecorder) NewMultipartUpload(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMultipartUpload", reflect.TypeOf((*MockObjectLayer)(nil).NewMultipartUpload), arg0, arg1, arg2, arg3) -} - -// PutObject mocks base method -func (m *MockObjectLayer) PutObject(arg0 context.Context, arg1, arg2 string, arg3 *hash.Reader, arg4 map[string]string) (cmd.ObjectInfo, error) { - ret := m.ctrl.Call(m, "PutObject", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(cmd.ObjectInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PutObject indicates an expected call of PutObject -func (mr *MockObjectLayerMockRecorder) PutObject(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObject", reflect.TypeOf((*MockObjectLayer)(nil).PutObject), arg0, arg1, arg2, arg3, arg4) -} - -// PutObjectPart mocks base method -func (m *MockObjectLayer) PutObjectPart(arg0 context.Context, arg1, arg2, arg3 string, arg4 int, arg5 *hash.Reader) (cmd.PartInfo, error) { - ret := m.ctrl.Call(m, "PutObjectPart", arg0, arg1, arg2, arg3, arg4, arg5) - ret0, _ := ret[0].(cmd.PartInfo) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// PutObjectPart indicates an expected call of PutObjectPart -func (mr *MockObjectLayerMockRecorder) PutObjectPart(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "PutObjectPart", reflect.TypeOf((*MockObjectLayer)(nil).PutObjectPart), arg0, arg1, arg2, arg3, arg4, arg5) -} - -// ReloadFormat mocks base method -func (m *MockObjectLayer) ReloadFormat(arg0 context.Context, arg1 bool) error { - ret := m.ctrl.Call(m, "ReloadFormat", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// ReloadFormat indicates an expected call of ReloadFormat -func (mr *MockObjectLayerMockRecorder) ReloadFormat(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReloadFormat", reflect.TypeOf((*MockObjectLayer)(nil).ReloadFormat), arg0, arg1) -} - -// SetBucketPolicy mocks base method -func (m *MockObjectLayer) SetBucketPolicy(arg0 context.Context, arg1 string, arg2 *policy.Policy) error { - ret := m.ctrl.Call(m, "SetBucketPolicy", arg0, arg1, arg2) - ret0, _ := ret[0].(error) - return ret0 -} - -// SetBucketPolicy indicates an expected call of SetBucketPolicy -func (mr *MockObjectLayerMockRecorder) SetBucketPolicy(arg0, arg1, arg2 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBucketPolicy", reflect.TypeOf((*MockObjectLayer)(nil).SetBucketPolicy), arg0, arg1, arg2) -} - -// Shutdown mocks base method -func (m *MockObjectLayer) Shutdown(arg0 context.Context) error { - ret := m.ctrl.Call(m, "Shutdown", arg0) - ret0, _ := ret[0].(error) - return ret0 -} - -// Shutdown indicates an expected call of Shutdown -func (mr *MockObjectLayerMockRecorder) Shutdown(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockObjectLayer)(nil).Shutdown), arg0) -} - -// StorageInfo mocks base method -func (m *MockObjectLayer) StorageInfo(arg0 context.Context) cmd.StorageInfo { - ret := m.ctrl.Call(m, "StorageInfo", arg0) - ret0, _ := ret[0].(cmd.StorageInfo) - return ret0 -} - -// StorageInfo indicates an expected call of StorageInfo -func (mr *MockObjectLayerMockRecorder) StorageInfo(arg0 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "StorageInfo", reflect.TypeOf((*MockObjectLayer)(nil).StorageInfo), arg0) -} diff --git a/pkg/miniogw/objstore_mock_test.go b/pkg/miniogw/objstore_mock_test.go deleted file mode 100644 index b9d33bf85..000000000 --- a/pkg/miniogw/objstore_mock_test.go +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (C) 2018 Storj Labs, Inc. -// See LICENSE for copying information. - -// Code generated by MockGen. DO NOT EDIT. -// Source: storj.io/storj/pkg/storage/objects (interfaces: Store) - -// Package miniogw is a generated GoMock package. -package miniogw - -import ( - context "context" - io "io" - reflect "reflect" - time "time" - - gomock "github.com/golang/mock/gomock" - - "storj.io/storj/pkg/pb" - ranger "storj.io/storj/pkg/ranger" - objects "storj.io/storj/pkg/storage/objects" -) - -// MockStore is a mock of Store interface -type MockStore struct { - ctrl *gomock.Controller - recorder *MockStoreMockRecorder -} - -// MockStoreMockRecorder is the mock recorder for MockStore -type MockStoreMockRecorder struct { - mock *MockStore -} - -// NewMockStore creates a new mock instance -func NewMockStore(ctrl *gomock.Controller) *MockStore { - mock := &MockStore{ctrl: ctrl} - mock.recorder = &MockStoreMockRecorder{mock} - return mock -} - -// EXPECT returns an object that allows the caller to indicate expected use -func (m *MockStore) EXPECT() *MockStoreMockRecorder { - return m.recorder -} - -// Delete mocks base method -func (m *MockStore) Delete(arg0 context.Context, arg1 string) error { - ret := m.ctrl.Call(m, "Delete", arg0, arg1) - ret0, _ := ret[0].(error) - return ret0 -} - -// Delete indicates an expected call of Delete -func (mr *MockStoreMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockStore)(nil).Delete), arg0, arg1) -} - -// Get mocks base method -func (m *MockStore) Get(arg0 context.Context, arg1 string) (ranger.Ranger, objects.Meta, error) { - ret := m.ctrl.Call(m, "Get", arg0, arg1) - ret0, _ := ret[0].(ranger.Ranger) - ret1, _ := ret[1].(objects.Meta) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// Get indicates an expected call of Get -func (mr *MockStoreMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockStore)(nil).Get), arg0, arg1) -} - -// List mocks base method -func (m *MockStore) List(arg0 context.Context, arg1, arg2, arg3 string, arg4 bool, arg5 int, arg6 uint32) ([]objects.ListItem, bool, error) { - ret := m.ctrl.Call(m, "List", arg0, arg1, arg2, arg3, arg4, arg5, arg6) - ret0, _ := ret[0].([]objects.ListItem) - ret1, _ := ret[1].(bool) - ret2, _ := ret[2].(error) - return ret0, ret1, ret2 -} - -// List indicates an expected call of List -func (mr *MockStoreMockRecorder) List(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockStore)(nil).List), arg0, arg1, arg2, arg3, arg4, arg5, arg6) -} - -// Meta mocks base method -func (m *MockStore) Meta(arg0 context.Context, arg1 string) (objects.Meta, error) { - ret := m.ctrl.Call(m, "Meta", arg0, arg1) - ret0, _ := ret[0].(objects.Meta) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Meta indicates an expected call of Meta -func (mr *MockStoreMockRecorder) Meta(arg0, arg1 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Meta", reflect.TypeOf((*MockStore)(nil).Meta), arg0, arg1) -} - -// Put mocks base method -func (m *MockStore) Put(arg0 context.Context, arg1 string, arg2 io.Reader, arg3 pb.SerializableMeta, arg4 time.Time) (objects.Meta, error) { - ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4) - ret0, _ := ret[0].(objects.Meta) - ret1, _ := ret[1].(error) - return ret0, ret1 -} - -// Put indicates an expected call of Put -func (mr *MockStoreMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockStore)(nil).Put), arg0, arg1, arg2, arg3, arg4) -}