diff --git a/pkg/storage/fs/posix/tree/tree.go b/pkg/storage/fs/posix/tree/tree.go index 18228ff548..f5a287457b 100644 --- a/pkg/storage/fs/posix/tree/tree.go +++ b/pkg/storage/fs/posix/tree/tree.go @@ -108,7 +108,7 @@ func New(lu node.PathLookup, bs Blobstore, um usermapper.Mapper, trashbin *trash trashbin: trashbin, options: o, idCache: cache, - propagator: propagator.New(lu, &o.Options), + propagator: propagator.New(lu, &o.Options, log), scanQueue: scanQueue, scanDebouncer: NewScanDebouncer(o.ScanDebounceDelay, func(item scanItem) { scanQueue <- item diff --git a/pkg/storage/utils/decomposedfs/decomposedfs.go b/pkg/storage/utils/decomposedfs/decomposedfs.go index b1abd267f9..cf132a1cac 100644 --- a/pkg/storage/utils/decomposedfs/decomposedfs.go +++ b/pkg/storage/utils/decomposedfs/decomposedfs.go @@ -156,7 +156,7 @@ func NewDefault(m map[string]interface{}, bs tree.Blobstore, es events.Stream, l microstore.Table(o.IDCache.Table), store.DisablePersistence(o.IDCache.DisablePersistence), store.Authentication(o.IDCache.AuthUsername, o.IDCache.AuthPassword), - )) + ), log) permissionsSelector, err := pool.PermissionsSelector(o.PermissionsSVC, pool.WithTLSMode(o.PermTLSMode)) if err != nil { diff --git a/pkg/storage/utils/decomposedfs/testhelpers/helpers.go b/pkg/storage/utils/decomposedfs/testhelpers/helpers.go index c0502a3ea5..a7313db833 100644 --- a/pkg/storage/utils/decomposedfs/testhelpers/helpers.go +++ b/pkg/storage/utils/decomposedfs/testhelpers/helpers.go @@ -171,15 +171,16 @@ func NewTestEnv(config map[string]interface{}) (*TestEnv, error) { }, ) + log := &zerolog.Logger{} bs := &treemocks.Blobstore{} - tree := tree.New(lu, bs, o, store.Create()) + tree := tree.New(lu, bs, o, store.Create(), log) aspects := aspects.Aspects{ Lookup: lu, Tree: tree, Permissions: permissions.NewPermissions(pmock, permissionsSelector), Trashbin: &decomposedfs.DecomposedfsTrashbin{}, } - fs, err := decomposedfs.New(o, aspects, &zerolog.Logger{}) + fs, err := decomposedfs.New(o, aspects, log) if err != nil { return nil, err } diff --git a/pkg/storage/utils/decomposedfs/tree/propagator/async.go b/pkg/storage/utils/decomposedfs/tree/propagator/async.go index 14e65dea06..050e1c6ecd 100644 --- a/pkg/storage/utils/decomposedfs/tree/propagator/async.go +++ b/pkg/storage/utils/decomposedfs/tree/propagator/async.go @@ -27,7 +27,6 @@ import ( "time" "github.com/cs3org/reva/v2/pkg/appctx" - "github.com/cs3org/reva/v2/pkg/logger" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/lookup" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes" @@ -49,6 +48,7 @@ type AsyncPropagator struct { treeTimeAccounting bool propagationDelay time.Duration lookup node.PathLookup + log *zerolog.Logger } // Change represents a change to the tree @@ -58,16 +58,15 @@ type Change struct { } // NewAsyncPropagator returns a new AsyncPropagator instance -func NewAsyncPropagator(treeSizeAccounting, treeTimeAccounting bool, o options.AsyncPropagatorOptions, lookup node.PathLookup) AsyncPropagator { +func NewAsyncPropagator(treeSizeAccounting, treeTimeAccounting bool, o options.AsyncPropagatorOptions, lookup node.PathLookup, log *zerolog.Logger) AsyncPropagator { p := AsyncPropagator{ treeSizeAccounting: treeSizeAccounting, treeTimeAccounting: treeTimeAccounting, propagationDelay: o.PropagationDelay, lookup: lookup, + log: log, } - log := logger.New() - log.Info().Msg("async propagator starting up...") // spawn a goroutine that watches for stale .processing dirs and fixes them diff --git a/pkg/storage/utils/decomposedfs/tree/propagator/propagator.go b/pkg/storage/utils/decomposedfs/tree/propagator/propagator.go index 008e8d9881..6d77e28e45 100644 --- a/pkg/storage/utils/decomposedfs/tree/propagator/propagator.go +++ b/pkg/storage/utils/decomposedfs/tree/propagator/propagator.go @@ -30,6 +30,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/node" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options" "github.com/pkg/errors" + "github.com/rs/zerolog" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" ) @@ -44,10 +45,10 @@ type Propagator interface { Propagate(ctx context.Context, node *node.Node, sizediff int64) error } -func New(lookup node.PathLookup, o *options.Options) Propagator { +func New(lookup node.PathLookup, o *options.Options, log *zerolog.Logger) Propagator { switch o.Propagator { case "async": - return NewAsyncPropagator(o.TreeSizeAccounting, o.TreeTimeAccounting, o.AsyncPropagatorOptions, lookup) + return NewAsyncPropagator(o.TreeSizeAccounting, o.TreeTimeAccounting, o.AsyncPropagatorOptions, lookup, log) default: return NewSyncPropagator(o.TreeSizeAccounting, o.TreeTimeAccounting, lookup) } diff --git a/pkg/storage/utils/decomposedfs/tree/tree.go b/pkg/storage/utils/decomposedfs/tree/tree.go index 83096baf41..d579ac2bec 100644 --- a/pkg/storage/utils/decomposedfs/tree/tree.go +++ b/pkg/storage/utils/decomposedfs/tree/tree.go @@ -42,6 +42,7 @@ import ( "github.com/cs3org/reva/v2/pkg/utils" "github.com/google/uuid" "github.com/pkg/errors" + "github.com/rs/zerolog" "go-micro.dev/v4/store" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" @@ -76,13 +77,13 @@ type Tree struct { type PermissionCheckFunc func(rp *provider.ResourcePermissions) bool // New returns a new instance of Tree -func New(lu node.PathLookup, bs Blobstore, o *options.Options, cache store.Store) *Tree { +func New(lu node.PathLookup, bs Blobstore, o *options.Options, cache store.Store, log *zerolog.Logger) *Tree { return &Tree{ lookup: lu, blobstore: bs, options: o, idCache: cache, - propagator: propagator.New(lu, o), + propagator: propagator.New(lu, o, log), } } diff --git a/pkg/storage/utils/decomposedfs/upload/store_test.go b/pkg/storage/utils/decomposedfs/upload/store_test.go index 1473c9e296..573b93031c 100644 --- a/pkg/storage/utils/decomposedfs/upload/store_test.go +++ b/pkg/storage/utils/decomposedfs/upload/store_test.go @@ -16,6 +16,7 @@ import ( "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/options" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/timemanager" "github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/tree" + "github.com/rs/zerolog" ) // TestInitNewNode calls greetings.initNewNode @@ -24,7 +25,7 @@ func TestInitNewNode(t *testing.T) { root := t.TempDir() lookup := lookup.New(metadata.NewMessagePackBackend(root, cache.Config{}), &options.Options{Root: root}, &timemanager.Manager{}) - tp := tree.New(lookup, nil, &options.Options{}, nil) + tp := tree.New(lookup, nil, &options.Options{}, nil, &zerolog.Logger{}) aspects := aspects.Aspects{ Lookup: lookup, diff --git a/pkg/storage/utils/decomposedfs/upload_async_test.go b/pkg/storage/utils/decomposedfs/upload_async_test.go index 4ce18be7b8..0f6b749865 100644 --- a/pkg/storage/utils/decomposedfs/upload_async_test.go +++ b/pkg/storage/utils/decomposedfs/upload_async_test.go @@ -172,7 +172,7 @@ var _ = Describe("Async file uploads", Ordered, func() { // setup fs pub, con = make(chan interface{}), make(chan interface{}) - tree := tree.New(lu, bs, o, store.Create()) + tree := tree.New(lu, bs, o, store.Create(), &zerolog.Logger{}) aspects := aspects.Aspects{ Lookup: lu, diff --git a/pkg/storage/utils/decomposedfs/upload_test.go b/pkg/storage/utils/decomposedfs/upload_test.go index b35f36286b..6a99f95e9e 100644 --- a/pkg/storage/utils/decomposedfs/upload_test.go +++ b/pkg/storage/utils/decomposedfs/upload_test.go @@ -137,7 +137,7 @@ var _ = Describe("File uploads", func() { AddGrant: true, }, nil).Times(1) var err error - tree := tree.New(lu, bs, o, store.Create()) + tree := tree.New(lu, bs, o, store.Create(), &zerolog.Logger{}) aspects := aspects.Aspects{ Lookup: lu,