diff --git a/.drone.star b/.drone.star index ee07729bff..b42526c117 100644 --- a/.drone.star +++ b/.drone.star @@ -761,7 +761,7 @@ def posixfsIntegrationTests(parallelRuns, skipExceptParts = []): "environment": { "TEST_SERVER_URL": "http://revad-services:20080", "OCIS_REVA_DATA_ROOT": "/drone/src/tmp/reva/data/", - "DELETE_USER_DATA_CMD": "bash -cx 'for i in {1..30}; do rm -rf /drone/src/tmp/reva/data/users/* /drone/src/tmp/reva/data/indexes/by-type/* && break || sleep 5; done; sleep 0.1'", + "DELETE_USER_DATA_CMD": "bash -cx 'for i in {1..30}; do rm -rf /drone/src/tmp/reva/data/users/* /drone/src/tmp/reva/data/indexes/by-type/* && break || sleep 5; done; sleep 1'", "STORAGE_DRIVER": "ocis", "SKELETON_DIR": "/drone/src/tmp/testing/data/apiSkeleton", "TEST_WITH_LDAP": "true", diff --git a/changelog/unreleased/pass-initialized-loggers.md b/changelog/unreleased/pass-initialized-loggers.md new file mode 100644 index 0000000000..b8dc8ec936 --- /dev/null +++ b/changelog/unreleased/pass-initialized-loggers.md @@ -0,0 +1,5 @@ +Enhancement: Pass the initialized logger down the stack + +We now make the initialized logger available to grpc services and storage drivers, which allows for easier and more uniform logging. + +https://github.com/cs3org/reva/pull/4951 diff --git a/internal/grpc/services/applicationauth/applicationauth.go b/internal/grpc/services/applicationauth/applicationauth.go index 3aa6061df4..579ea5b401 100644 --- a/internal/grpc/services/applicationauth/applicationauth.go +++ b/internal/grpc/services/applicationauth/applicationauth.go @@ -29,6 +29,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -73,7 +74,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a app auth provider svc -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { diff --git a/internal/grpc/services/appprovider/appprovider.go b/internal/grpc/services/appprovider/appprovider.go index 14a69fcf6a..eb9b58944e 100644 --- a/internal/grpc/services/appprovider/appprovider.go +++ b/internal/grpc/services/appprovider/appprovider.go @@ -39,6 +39,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/juliangruber/go-intersect" "github.com/mitchellh/mapstructure" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -84,7 +85,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a new AppProviderService -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/appregistry/appregistry.go b/internal/grpc/services/appregistry/appregistry.go index a31c556b46..46bd6a64c6 100644 --- a/internal/grpc/services/appregistry/appregistry.go +++ b/internal/grpc/services/appregistry/appregistry.go @@ -30,6 +30,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" + "github.com/rs/zerolog" ) func init() { @@ -64,7 +65,7 @@ func (c *config) init() { } // New creates a new StorageRegistryService -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { diff --git a/internal/grpc/services/appregistry/appregistry_test.go b/internal/grpc/services/appregistry/appregistry_test.go index da5b2ecc5c..036f7b4566 100644 --- a/internal/grpc/services/appregistry/appregistry_test.go +++ b/internal/grpc/services/appregistry/appregistry_test.go @@ -356,7 +356,7 @@ func TestNew(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := New(tt.m, nil) + got, err := New(tt.m, nil, nil) if err != nil { assert.Equal(t, tt.wantErr, err.Error()) assert.Nil(t, got) diff --git a/internal/grpc/services/authprovider/authprovider.go b/internal/grpc/services/authprovider/authprovider.go index ec2ca9dc66..e8db9757db 100644 --- a/internal/grpc/services/authprovider/authprovider.go +++ b/internal/grpc/services/authprovider/authprovider.go @@ -33,6 +33,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -95,7 +96,7 @@ func getAuthManager(manager string, m map[string]map[string]interface{}) (auth.M } // New returns a new AuthProviderServiceServer. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/authregistry/authregistry.go b/internal/grpc/services/authregistry/authregistry.go index 51967f76f6..999843d2b4 100644 --- a/internal/grpc/services/authregistry/authregistry.go +++ b/internal/grpc/services/authregistry/authregistry.go @@ -28,6 +28,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -66,7 +67,7 @@ func (c *config) init() { } // New creates a new AuthRegistry -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/datatx/datatx.go b/internal/grpc/services/datatx/datatx.go index c43e75ec88..f0a1491ae1 100644 --- a/internal/grpc/services/datatx/datatx.go +++ b/internal/grpc/services/datatx/datatx.go @@ -37,6 +37,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -117,7 +118,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a new datatx svc -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { diff --git a/internal/grpc/services/gateway/gateway.go b/internal/grpc/services/gateway/gateway.go index d16bf42cb2..016d422cc7 100644 --- a/internal/grpc/services/gateway/gateway.go +++ b/internal/grpc/services/gateway/gateway.go @@ -32,6 +32,7 @@ import ( "github.com/cs3org/reva/v2/pkg/token/manager/registry" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -150,7 +151,7 @@ type svc struct { // New creates a new gateway svc that acts as a proxy for any grpc operation. // The gateway is responsible for high-level controls: rate-limiting, coordination between svcs // like sharing and storage acls, asynchronous transactions, ... -func New(m map[string]interface{}, _ *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, _ *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/groupprovider/groupprovider.go b/internal/grpc/services/groupprovider/groupprovider.go index ff9c9b2ec0..6c818b5cf9 100644 --- a/internal/grpc/services/groupprovider/groupprovider.go +++ b/internal/grpc/services/groupprovider/groupprovider.go @@ -31,6 +31,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -68,7 +69,7 @@ func getDriver(c *config) (group.Manager, error) { } // New returns a new GroupProviderServiceServer. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/helloworld/helloworld.go b/internal/grpc/services/helloworld/helloworld.go index 3186eb04d2..2dba2dedf8 100644 --- a/internal/grpc/services/helloworld/helloworld.go +++ b/internal/grpc/services/helloworld/helloworld.go @@ -26,6 +26,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -43,7 +44,7 @@ type service struct { // New returns a new PreferencesServiceServer // It can be tested like this: // prototool grpc --address 0.0.0.0:9999 --method 'revad.helloworld.HelloWorldService/Hello' --data '{"name": "Alice"}' -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c := &conf{} if err := mapstructure.Decode(m, c); err != nil { err = errors.Wrap(err, "helloworld: error decoding conf") diff --git a/internal/grpc/services/ocmcore/ocmcore.go b/internal/grpc/services/ocmcore/ocmcore.go index f3d7e7813b..c9946c3c96 100644 --- a/internal/grpc/services/ocmcore/ocmcore.go +++ b/internal/grpc/services/ocmcore/ocmcore.go @@ -33,6 +33,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc" "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/cs3org/reva/v2/pkg/utils/cfg" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -68,7 +69,7 @@ func getShareRepository(c *config) (share.Repository, error) { } // New creates a new ocm core svc. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { var c config if err := cfg.Decode(m, &c); err != nil { return nil, err diff --git a/internal/grpc/services/ocminvitemanager/ocminvitemanager.go b/internal/grpc/services/ocminvitemanager/ocminvitemanager.go index f9bdc8baf9..328cb2b75f 100644 --- a/internal/grpc/services/ocminvitemanager/ocminvitemanager.go +++ b/internal/grpc/services/ocminvitemanager/ocminvitemanager.go @@ -40,6 +40,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/cs3org/reva/v2/pkg/utils/cfg" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -89,7 +90,7 @@ func getInviteRepository(c *config) (invite.Repository, error) { } // New creates a new OCM invite manager svc. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { var c config if err := cfg.Decode(m, &c); err != nil { return nil, err diff --git a/internal/grpc/services/ocmproviderauthorizer/ocmproviderauthorizer.go b/internal/grpc/services/ocmproviderauthorizer/ocmproviderauthorizer.go index 374ebd3f83..1d5e14f940 100644 --- a/internal/grpc/services/ocmproviderauthorizer/ocmproviderauthorizer.go +++ b/internal/grpc/services/ocmproviderauthorizer/ocmproviderauthorizer.go @@ -29,6 +29,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -73,7 +74,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a new OCM provider authorizer svc -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { diff --git a/internal/grpc/services/ocmshareprovider/ocmshareprovider.go b/internal/grpc/services/ocmshareprovider/ocmshareprovider.go index ad7c36ca93..f1b0ed09e1 100644 --- a/internal/grpc/services/ocmshareprovider/ocmshareprovider.go +++ b/internal/grpc/services/ocmshareprovider/ocmshareprovider.go @@ -49,6 +49,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/cs3org/reva/v2/pkg/utils/cfg" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -102,7 +103,7 @@ func getShareRepository(c *config) (share.Repository, error) { } // New creates a new ocm share provider svc. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { var c config if err := cfg.Decode(m, &c); err != nil { return nil, err diff --git a/internal/grpc/services/permissions/permissions.go b/internal/grpc/services/permissions/permissions.go index 1312a7f750..9b95799f5d 100644 --- a/internal/grpc/services/permissions/permissions.go +++ b/internal/grpc/services/permissions/permissions.go @@ -29,6 +29,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -55,7 +56,7 @@ type service struct { } // New returns a new PermissionsServiceServer -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/preferences/preferences.go b/internal/grpc/services/preferences/preferences.go index f20698c6f7..13ec4a3312 100644 --- a/internal/grpc/services/preferences/preferences.go +++ b/internal/grpc/services/preferences/preferences.go @@ -31,6 +31,7 @@ import ( "github.com/cs3org/reva/v2/pkg/rgrpc/status" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -70,7 +71,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New returns a new PreferencesServiceServer -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/publicshareprovider/publicshareprovider.go b/internal/grpc/services/publicshareprovider/publicshareprovider.go index 1c97430457..fdddeae2ae 100644 --- a/internal/grpc/services/publicshareprovider/publicshareprovider.go +++ b/internal/grpc/services/publicshareprovider/publicshareprovider.go @@ -38,6 +38,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" "github.com/cs3org/reva/v2/pkg/appctx" @@ -128,7 +129,7 @@ func parsePasswordPolicy(m map[string]interface{}) (*passwordPolicy, error) { } // New creates a new public share provider svc initialized from defaults -func NewDefault(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func NewDefault(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go index dd685e183a..c743372295 100644 --- a/internal/grpc/services/publicstorageprovider/publicstorageprovider.go +++ b/internal/grpc/services/publicstorageprovider/publicstorageprovider.go @@ -43,6 +43,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "go.opentelemetry.io/otel/attribute" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -88,7 +89,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a new publicstorageprovider service. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go index 86eae86859..8dff672ee0 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider.go @@ -25,6 +25,7 @@ import ( "strings" "github.com/cs3org/reva/v2/pkg/storagespace" + "github.com/rs/zerolog" "golang.org/x/sync/errgroup" "google.golang.org/genproto/protobuf/field_mask" "google.golang.org/grpc" @@ -84,7 +85,7 @@ func (s *service) Register(ss *grpc.Server) { } // NewDefault returns a new instance of the SharesStorageProvider service with default dependencies -func NewDefault(m map[string]interface{}, _ *grpc.Server) (rgrpc.Service, error) { +func NewDefault(m map[string]interface{}, _ *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c := &config{} if err := mapstructure.Decode(m, c); err != nil { err = errors.Wrap(err, "error decoding conf") diff --git a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go index 5ebb75e9a0..ab501fe18a 100644 --- a/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go +++ b/internal/grpc/services/sharesstorageprovider/sharesstorageprovider_test.go @@ -379,7 +379,7 @@ var _ = Describe("Sharesstorageprovider", func() { "mount_id": "shareprovidermountid", }, } - s, err := provider.NewDefault(config, nil) + s, err := provider.NewDefault(config, nil, nil) Expect(err).ToNot(HaveOccurred()) Expect(s).ToNot(BeNil()) }) diff --git a/internal/grpc/services/storageprovider/storageprovider.go b/internal/grpc/services/storageprovider/storageprovider.go index 80c6ef0b84..05b583e0be 100644 --- a/internal/grpc/services/storageprovider/storageprovider.go +++ b/internal/grpc/services/storageprovider/storageprovider.go @@ -49,6 +49,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "go.opentelemetry.io/otel/attribute" "google.golang.org/grpc" ) @@ -165,7 +166,7 @@ func registerMimeTypes(mappingFile string) error { } // New creates a new storage provider svc -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, log *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { @@ -174,7 +175,7 @@ func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { c.init() - fs, err := getFS(c) + fs, err := getFS(c, log) if err != nil { return nil, err } @@ -1276,7 +1277,7 @@ func (s *Service) addMissingStorageProviderID(resourceID *provider.ResourceId, s } } -func getFS(c *config) (storage.FS, error) { +func getFS(c *config, log *zerolog.Logger) (storage.FS, error) { evstream, err := estreamFromConfig(c.Events) if err != nil { return nil, err @@ -1286,7 +1287,7 @@ func getFS(c *config) (storage.FS, error) { driverConf := c.Drivers[c.Driver] driverConf["mount_id"] = c.MountID // pass the mount id to the driver - return f(driverConf, evstream) + return f(driverConf, evstream, log) } return nil, errtypes.NotFound("driver not found: " + c.Driver) diff --git a/internal/grpc/services/storageregistry/storageregistry.go b/internal/grpc/services/storageregistry/storageregistry.go index 291809440b..bcbfd579f8 100644 --- a/internal/grpc/services/storageregistry/storageregistry.go +++ b/internal/grpc/services/storageregistry/storageregistry.go @@ -35,6 +35,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage" "github.com/cs3org/reva/v2/pkg/storage/registry/registry" "github.com/mitchellh/mapstructure" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -70,7 +71,7 @@ func (c *config) init() { } // New creates a new StorageBrokerService -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/userprovider/userprovider.go b/internal/grpc/services/userprovider/userprovider.go index 94b7351d73..6ec3897691 100644 --- a/internal/grpc/services/userprovider/userprovider.go +++ b/internal/grpc/services/userprovider/userprovider.go @@ -34,6 +34,7 @@ import ( "github.com/cs3org/reva/v2/pkg/user/manager/registry" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" ) @@ -88,7 +89,7 @@ func getDriver(c *config) (user.Manager, *plugin.RevaPlugin, error) { } // New returns a new UserProviderServiceServer. -func New(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func New(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/internal/grpc/services/usershareprovider/usershareprovider.go b/internal/grpc/services/usershareprovider/usershareprovider.go index 66096689dd..f84736abac 100644 --- a/internal/grpc/services/usershareprovider/usershareprovider.go +++ b/internal/grpc/services/usershareprovider/usershareprovider.go @@ -33,6 +33,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "google.golang.org/grpc" "github.com/cs3org/reva/v2/pkg/appctx" @@ -108,7 +109,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { } // New creates a new user share provider svc initialized from defaults -func NewDefault(m map[string]interface{}, ss *grpc.Server) (rgrpc.Service, error) { +func NewDefault(m map[string]interface{}, ss *grpc.Server, _ *zerolog.Logger) (rgrpc.Service, error) { c, err := parseConfig(m) if err != nil { diff --git a/internal/http/services/dataprovider/dataprovider.go b/internal/http/services/dataprovider/dataprovider.go index f9c14e7b88..f04588c5ad 100644 --- a/internal/http/services/dataprovider/dataprovider.go +++ b/internal/http/services/dataprovider/dataprovider.go @@ -98,7 +98,7 @@ func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error) evstream = s } - fs, err := getFS(conf, evstream) + fs, err := getFS(conf, evstream, log) if err != nil { return nil, err } @@ -118,9 +118,9 @@ func New(m map[string]interface{}, log *zerolog.Logger) (global.Service, error) return s, err } -func getFS(c *config, stream events.Stream) (storage.FS, error) { +func getFS(c *config, stream events.Stream, log *zerolog.Logger) (storage.FS, error) { if f, ok := registry.NewFuncs[c.Driver]; ok { - return f(c.Drivers[c.Driver], stream) + return f(c.Drivers[c.Driver], stream, log) } return nil, fmt.Errorf("driver not found: %s", c.Driver) } diff --git a/pkg/cbox/storage/eoshomewrapper/eoshomewrapper.go b/pkg/cbox/storage/eoshomewrapper/eoshomewrapper.go index e3f31b8d63..319d05c7b1 100644 --- a/pkg/cbox/storage/eoshomewrapper/eoshomewrapper.go +++ b/pkg/cbox/storage/eoshomewrapper/eoshomewrapper.go @@ -33,6 +33,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/eosfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -66,7 +67,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, string, error) { // New returns an implementation of the storage.FS interface that forms a wrapper // around separate connections to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, t, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/cbox/storage/eoswrapper/eoswrapper.go b/pkg/cbox/storage/eoswrapper/eoswrapper.go index f9ef19690f..0b90248f73 100644 --- a/pkg/cbox/storage/eoswrapper/eoswrapper.go +++ b/pkg/cbox/storage/eoswrapper/eoswrapper.go @@ -30,6 +30,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" "github.com/cs3org/reva/v2/pkg/errtypes" @@ -87,7 +88,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, string, error) { // New returns an implementation of the storage.FS interface that forms a wrapper // around separate connections to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, t, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/ocm/storage/received/ocm.go b/pkg/ocm/storage/received/ocm.go index f43c24cd35..c76fe8141a 100644 --- a/pkg/ocm/storage/received/ocm.go +++ b/pkg/ocm/storage/received/ocm.go @@ -38,6 +38,7 @@ import ( ocmpb "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" typepb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" + "github.com/rs/zerolog" "github.com/studio-b12/gowebdav" "github.com/cs3org/reva/v2/pkg/errtypes" @@ -101,7 +102,7 @@ func (BearerAuthenticator) Close() error { } // New creates an OCM storage driver. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { var c config if err := cfg.Decode(m, &c); err != nil { return nil, err diff --git a/pkg/rgrpc/rgrpc.go b/pkg/rgrpc/rgrpc.go index c04bedc3da..01b5021bed 100644 --- a/pkg/rgrpc/rgrpc.go +++ b/pkg/rgrpc/rgrpc.go @@ -78,7 +78,7 @@ func Register(name string, newFunc NewService) { // NewService is the function that gRPC services need to register at init time. // It returns an io.Closer to close the service and a list of service endpoints that need to be unprotected. -type NewService func(conf map[string]interface{}, ss *grpc.Server) (Service, error) +type NewService func(conf map[string]interface{}, ss *grpc.Server, log *zerolog.Logger) (Service, error) // Service represents a grpc service. type Service interface { @@ -220,7 +220,7 @@ func (s *Server) registerServices() error { for svcName := range s.conf.Services { if s.isServiceEnabled(svcName) { newFunc := Services[svcName] - svc, err := newFunc(s.conf.Services[svcName], s.s) + svc, err := newFunc(s.conf.Services[svcName], s.s, &s.log) if err != nil { return errors.Wrapf(err, "rgrpc: grpc service %s could not be started,", svcName) } diff --git a/pkg/storage/fs/cephfs/cephfs.go b/pkg/storage/fs/cephfs/cephfs.go index 08180f5220..554de78b9e 100644 --- a/pkg/storage/fs/cephfs/cephfs.go +++ b/pkg/storage/fs/cephfs/cephfs.go @@ -35,6 +35,7 @@ import ( provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/cs3org/reva/v2/pkg/appctx" "github.com/cs3org/reva/v2/pkg/errtypes" @@ -66,7 +67,7 @@ func init() { // New returns an implementation to of the storage.FS interface that talk to // a ceph filesystem. -func New(m map[string]interface{}, _ events.Stream) (fs storage.FS, err error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (fs storage.FS, err error) { c := &Options{} if err = mapstructure.Decode(m, c); err != nil { return nil, errors.Wrap(err, "error decoding conf") diff --git a/pkg/storage/fs/cephfs/unsupported.go b/pkg/storage/fs/cephfs/unsupported.go index e11e805168..ee778d5772 100644 --- a/pkg/storage/fs/cephfs/unsupported.go +++ b/pkg/storage/fs/cephfs/unsupported.go @@ -23,6 +23,7 @@ package cephfs import ( "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/storage" @@ -35,6 +36,6 @@ func init() { // New returns an implementation to of the storage.FS interface that talk to // a ceph filesystem. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { return nil, errors.New("cephfs: revad was compiled without CephFS support") } diff --git a/pkg/storage/fs/eos/eos.go b/pkg/storage/fs/eos/eos.go index e8b3f48225..02b5013ef4 100644 --- a/pkg/storage/fs/eos/eos.go +++ b/pkg/storage/fs/eos/eos.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/eosfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -47,7 +48,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, error) { } // New returns a new implementation of the storage.FS interface that connects to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/eosgrpc/eosgrpc.go b/pkg/storage/fs/eosgrpc/eosgrpc.go index 6ce66df7ea..1b55e48f71 100644 --- a/pkg/storage/fs/eosgrpc/eosgrpc.go +++ b/pkg/storage/fs/eosgrpc/eosgrpc.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/eosfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -47,7 +48,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, error) { } // New returns a new implementation of the storage.FS interface that connects to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/eosgrpchome/eosgrpchome.go b/pkg/storage/fs/eosgrpchome/eosgrpchome.go index 8dc36527bb..a78d4ee0bb 100644 --- a/pkg/storage/fs/eosgrpchome/eosgrpchome.go +++ b/pkg/storage/fs/eosgrpchome/eosgrpchome.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/eosfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -47,7 +48,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, error) { } // New returns a new implementation of the storage.FS interface that connects to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/eoshome/eoshome.go b/pkg/storage/fs/eoshome/eoshome.go index 0e8cfb85d3..3a14c943bf 100644 --- a/pkg/storage/fs/eoshome/eoshome.go +++ b/pkg/storage/fs/eoshome/eoshome.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/eosfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -47,7 +48,7 @@ func parseConfig(m map[string]interface{}) (*eosfs.Config, error) { } // New returns a new implementation of the storage.FS interface that connects to EOS. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/hello/hello.go b/pkg/storage/fs/hello/hello.go index f87062feb4..3b50ee82b5 100644 --- a/pkg/storage/fs/hello/hello.go +++ b/pkg/storage/fs/hello/hello.go @@ -29,6 +29,7 @@ import ( "time" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" + "github.com/rs/zerolog" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/events" @@ -144,7 +145,7 @@ func calcEtag(t time.Time, nodeid string) string { // New returns an implementation to of the storage.FS interface that talks to // a local filesystem with user homes disabled. -func New(_ map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(_ map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { return &hellofs{ bootTime: time.Now(), }, nil diff --git a/pkg/storage/fs/local/local.go b/pkg/storage/fs/local/local.go index a5510262a3..29b4eab89d 100644 --- a/pkg/storage/fs/local/local.go +++ b/pkg/storage/fs/local/local.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/localfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -49,7 +50,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { // New returns an implementation to of the storage.FS interface that talks to // a local filesystem with user homes disabled. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/localhome/localhome.go b/pkg/storage/fs/localhome/localhome.go index a442acbb52..dc7c0494c7 100644 --- a/pkg/storage/fs/localhome/localhome.go +++ b/pkg/storage/fs/localhome/localhome.go @@ -25,6 +25,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/localfs" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -48,7 +49,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { // New returns an implementation to of the storage.FS interface that talks to // a local filesystem with user homes. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/nextcloud/nextcloud.go b/pkg/storage/fs/nextcloud/nextcloud.go index efad4295e0..569aec1c07 100644 --- a/pkg/storage/fs/nextcloud/nextcloud.go +++ b/pkg/storage/fs/nextcloud/nextcloud.go @@ -33,6 +33,7 @@ import ( types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" @@ -72,7 +73,7 @@ func parseConfig(m map[string]interface{}) (*StorageDriverConfig, error) { // New returns an implementation to of the storage.FS interface that talks to // a Nextcloud instance over http. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { conf, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/nextcloud/nextcloud_test.go b/pkg/storage/fs/nextcloud/nextcloud_test.go index 10ff978b44..d6760d6d2e 100644 --- a/pkg/storage/fs/nextcloud/nextcloud_test.go +++ b/pkg/storage/fs/nextcloud/nextcloud_test.go @@ -118,7 +118,7 @@ var _ = Describe("Nextcloud", func() { Describe("New", func() { It("returns a new instance", func() { - _, err := nextcloud.New(options, nil) + _, err := nextcloud.New(options, nil, nil) Expect(err).ToNot(HaveOccurred()) }) }) diff --git a/pkg/storage/fs/ocis/ocis.go b/pkg/storage/fs/ocis/ocis.go index 812b44e4f7..f8ec0a85f3 100644 --- a/pkg/storage/fs/ocis/ocis.go +++ b/pkg/storage/fs/ocis/ocis.go @@ -27,6 +27,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/fs/registry" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options" + "github.com/rs/zerolog" ) func init() { @@ -35,7 +36,7 @@ func init() { // New returns an implementation to of the storage.FS interface that talk to // a local filesystem. -func New(m map[string]interface{}, stream events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, stream events.Stream, _ *zerolog.Logger) (storage.FS, error) { o, err := options.New(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/ocis/ocis_test.go b/pkg/storage/fs/ocis/ocis_test.go index 64b7436c17..db5a12bb6d 100644 --- a/pkg/storage/fs/ocis/ocis_test.go +++ b/pkg/storage/fs/ocis/ocis_test.go @@ -53,7 +53,7 @@ var _ = Describe("Ocis", func() { Describe("New", func() { It("returns a new instance", func() { - _, err := ocis.New(options, nil) + _, err := ocis.New(options, nil, nil) Expect(err).ToNot(HaveOccurred()) }) }) diff --git a/pkg/storage/fs/owncloudsql/owncloudsql.go b/pkg/storage/fs/owncloudsql/owncloudsql.go index 5cfaaca8b0..793f2eeb7c 100644 --- a/pkg/storage/fs/owncloudsql/owncloudsql.go +++ b/pkg/storage/fs/owncloudsql/owncloudsql.go @@ -42,6 +42,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/pkg/errors" "github.com/pkg/xattr" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/cs3org/reva/v2/internal/grpc/services/storageprovider" @@ -152,7 +153,7 @@ func (c *config) init(m map[string]interface{}) { // New returns an implementation to of the storage.FS interface that talk to // a local filesystem. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/posix/posix.go b/pkg/storage/fs/posix/posix.go index 537689d459..340f89b1fe 100644 --- a/pkg/storage/fs/posix/posix.go +++ b/pkg/storage/fs/posix/posix.go @@ -27,6 +27,7 @@ import ( "os" "syscall" + "github.com/rs/zerolog" tusd "github.com/tus/tusd/v2/pkg/handler" microstore "go-micro.dev/v4/store" @@ -64,7 +65,7 @@ type posixFS struct { // New returns an implementation to of the storage.FS interface that talk to // a local filesystem. -func New(m map[string]interface{}, stream events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, stream events.Stream, log *zerolog.Logger) (storage.FS, error) { o, err := options.New(m) if err != nil { return nil, err @@ -111,7 +112,7 @@ func New(m map[string]interface{}, stream events.Stream) (storage.FS, error) { microstore.Table(o.IDCache.Table), store.DisablePersistence(o.IDCache.DisablePersistence), store.Authentication(o.IDCache.AuthUsername, o.IDCache.AuthPassword), - )) + ), log) if err != nil { return nil, err } diff --git a/pkg/storage/fs/posix/posix_test.go b/pkg/storage/fs/posix/posix_test.go index 67f138ba68..5a7e1fcc9e 100644 --- a/pkg/storage/fs/posix/posix_test.go +++ b/pkg/storage/fs/posix/posix_test.go @@ -56,7 +56,7 @@ var _ = Describe("Posix", func() { Describe("New", func() { It("returns a new instance", func() { - _, err := posix.New(options, nil) + _, err := posix.New(options, nil, nil) Expect(err).ToNot(HaveOccurred()) }) }) diff --git a/pkg/storage/fs/posix/testhelpers/helpers.go b/pkg/storage/fs/posix/testhelpers/helpers.go index 1ed248ecc0..4cf8c8df70 100644 --- a/pkg/storage/fs/posix/testhelpers/helpers.go +++ b/pkg/storage/fs/posix/testhelpers/helpers.go @@ -178,7 +178,7 @@ func NewTestEnv(config map[string]interface{}) (*TestEnv, error) { ) bs := &treemocks.Blobstore{} - tree, err := tree.New(lu, bs, um, &trashbin.Trashbin{}, o, nil, store.Create()) + tree, err := tree.New(lu, bs, um, &trashbin.Trashbin{}, o, nil, store.Create(), nil) if err != nil { return nil, err } diff --git a/pkg/storage/fs/posix/tree/tree.go b/pkg/storage/fs/posix/tree/tree.go index 2ba94a88a7..7bf7e34a1b 100644 --- a/pkg/storage/fs/posix/tree/tree.go +++ b/pkg/storage/fs/posix/tree/tree.go @@ -41,7 +41,6 @@ import ( "github.com/cs3org/reva/v2/pkg/appctx" "github.com/cs3org/reva/v2/pkg/errtypes" "github.com/cs3org/reva/v2/pkg/events" - "github.com/cs3org/reva/v2/pkg/logger" "github.com/cs3org/reva/v2/pkg/storage/fs/posix/lookup" "github.com/cs3org/reva/v2/pkg/storage/fs/posix/options" "github.com/cs3org/reva/v2/pkg/storage/fs/posix/trashbin" @@ -100,8 +99,7 @@ type Tree struct { type PermissionCheckFunc func(rp *provider.ResourcePermissions) bool // New returns a new instance of Tree -func New(lu node.PathLookup, bs Blobstore, um usermapper.Mapper, trashbin *trashbin.Trashbin, o *options.Options, es events.Stream, cache store.Store) (*Tree, error) { - log := logger.New() +func New(lu node.PathLookup, bs Blobstore, um usermapper.Mapper, trashbin *trashbin.Trashbin, o *options.Options, es events.Stream, cache store.Store, log *zerolog.Logger) (*Tree, error) { scanQueue := make(chan scanItem) t := &Tree{ lookup: lu, diff --git a/pkg/storage/fs/registry/registry.go b/pkg/storage/fs/registry/registry.go index a75c8cf272..7e2aeb54d9 100644 --- a/pkg/storage/fs/registry/registry.go +++ b/pkg/storage/fs/registry/registry.go @@ -21,11 +21,12 @@ package registry import ( "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/storage" + "github.com/rs/zerolog" ) // NewFunc is the function that storage implementations // should register at init time. -type NewFunc func(map[string]interface{}, events.Stream) (storage.FS, error) +type NewFunc func(map[string]interface{}, events.Stream, *zerolog.Logger) (storage.FS, error) // NewFuncs is a map containing all the registered storage backends. var NewFuncs = map[string]NewFunc{} diff --git a/pkg/storage/fs/s3/s3.go b/pkg/storage/fs/s3/s3.go index 7717b716c6..b604e287f9 100644 --- a/pkg/storage/fs/s3/s3.go +++ b/pkg/storage/fs/s3/s3.go @@ -44,6 +44,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/fs/registry" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + "github.com/rs/zerolog" ) func init() { @@ -70,7 +71,7 @@ func parseConfig(m map[string]interface{}) (*config, error) { // New returns an implementation to of the storage.FS interface that talk to // a s3 api. -func New(m map[string]interface{}, _ events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, _ events.Stream, _ *zerolog.Logger) (storage.FS, error) { c, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/s3ng/s3ng.go b/pkg/storage/fs/s3ng/s3ng.go index 16360c898b..d261ad0ea5 100644 --- a/pkg/storage/fs/s3ng/s3ng.go +++ b/pkg/storage/fs/s3ng/s3ng.go @@ -26,6 +26,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/fs/registry" "github.com/cs3org/reva/v2/pkg/storage/fs/s3ng/blobstore" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs" + "github.com/rs/zerolog" ) func init() { @@ -34,7 +35,7 @@ func init() { // New returns an implementation to of the storage.FS interface that talk to // a local filesystem. -func New(m map[string]interface{}, stream events.Stream) (storage.FS, error) { +func New(m map[string]interface{}, stream events.Stream, _ *zerolog.Logger) (storage.FS, error) { o, err := parseConfig(m) if err != nil { return nil, err diff --git a/pkg/storage/fs/s3ng/s3ng_test.go b/pkg/storage/fs/s3ng/s3ng_test.go index 2051968507..bae0b88417 100644 --- a/pkg/storage/fs/s3ng/s3ng_test.go +++ b/pkg/storage/fs/s3ng/s3ng_test.go @@ -58,12 +58,12 @@ var _ = Describe("S3ng", func() { Describe("New", func() { It("fails on missing s3 configuration", func() { - _, err := s3ng.New(map[string]interface{}{}, nil) + _, err := s3ng.New(map[string]interface{}{}, nil, nil) Expect(err).To(MatchError("S3 configuration incomplete")) }) It("works with complete configuration", func() { - _, err := s3ng.New(options, nil) + _, err := s3ng.New(options, nil, nil) Expect(err).ToNot(HaveOccurred()) }) }) diff --git a/tests/integration/grpc/gateway_storageprovider_test.go b/tests/integration/grpc/gateway_storageprovider_test.go index 89dc41a32f..0a3efca07b 100644 --- a/tests/integration/grpc/gateway_storageprovider_test.go +++ b/tests/integration/grpc/gateway_storageprovider_test.go @@ -191,7 +191,7 @@ var _ = Describe("gateway", func() { "permissionssvc": revads["permissions"].GrpcAddress, "treesize_accounting": true, "treetime_accounting": true, - }, nil) + }, nil, nil) Expect(err).ToNot(HaveOccurred()) res, err := shard1Fs.CreateStorageSpace(ctx, &storagep.CreateStorageSpaceRequest{ Type: "project", @@ -217,7 +217,7 @@ var _ = Describe("gateway", func() { "permissionssvc": revads["permissions"].GrpcAddress, "treesize_accounting": true, "treetime_accounting": true, - }, nil) + }, nil, nil) Expect(err).ToNot(HaveOccurred()) res, err = shard2Fs.CreateStorageSpace(ctx, &storagep.CreateStorageSpaceRequest{ Type: "project", @@ -380,7 +380,7 @@ var _ = Describe("gateway", func() { "permissionssvc": revads["permissions"].GrpcAddress, "treesize_accounting": true, "treetime_accounting": true, - }, nil) + }, nil, nil) Expect(err).ToNot(HaveOccurred()) r, err := serviceClient.CreateHome(ctx, &storagep.CreateHomeRequest{}) @@ -405,7 +405,7 @@ var _ = Describe("gateway", func() { "permissionssvc": revads["permissions"].GrpcAddress, "treesize_accounting": true, "treetime_accounting": true, - }, nil) + }, nil, nil) Expect(err).ToNot(HaveOccurred()) res, err := serviceClient.CreateStorageSpace(ctx, &storagep.CreateStorageSpaceRequest{ Type: "project", diff --git a/tests/integration/grpc/ocm_share_test.go b/tests/integration/grpc/ocm_share_test.go index d58a66df42..19001698e9 100644 --- a/tests/integration/grpc/ocm_share_test.go +++ b/tests/integration/grpc/ocm_share_test.go @@ -224,7 +224,7 @@ var _ = Describe("ocm share", func() { fs, err := ocis.New(map[string]interface{}{ "root": revads["cernboxgw"].StorageRoot, "permissionssvc": revads["permissions"].GrpcAddress, - }, nil) + }, nil, nil) Expect(err).ToNot(HaveOccurred()) ref := &provider.Reference{ ResourceId: &provider.ResourceId{ diff --git a/tests/integration/grpc/storageprovider_test.go b/tests/integration/grpc/storageprovider_test.go index 02a889ecfd..3697b777f6 100644 --- a/tests/integration/grpc/storageprovider_test.go +++ b/tests/integration/grpc/storageprovider_test.go @@ -28,11 +28,11 @@ import ( storagep "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" "github.com/cs3org/reva/v2/pkg/auth/scope" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" - "github.com/cs3org/reva/v2/pkg/events" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/storage" "github.com/cs3org/reva/v2/pkg/storage/fs/nextcloud" "github.com/cs3org/reva/v2/pkg/storage/fs/ocis" + "github.com/cs3org/reva/v2/pkg/storage/fs/registry" jwt "github.com/cs3org/reva/v2/pkg/token/manager/jwt" "github.com/cs3org/reva/v2/tests/helpers" "github.com/google/uuid" @@ -56,7 +56,7 @@ func ref(provider string, path string) *storagep.Reference { func createFS(provider string, revads map[string]*Revad) (storage.FS, error) { conf := make(map[string]interface{}) - var f func(map[string]interface{}, events.Stream) (storage.FS, error) + var f registry.NewFunc switch provider { case "ocis": conf["root"] = revads["storage"].StorageRoot @@ -67,7 +67,7 @@ func createFS(provider string, revads map[string]*Revad) (storage.FS, error) { conf["mock_http"] = true f = nextcloud.New } - return f(conf, nil) + return f(conf, nil, nil) } // This test suite tests the gprc storageprovider interface using different