Merge pull request #10600 from aduffeck/bump-reva-6f05da

Bump reva 6f05da
This commit is contained in:
Michael Barz
2024-11-19 10:28:56 +01:00
committed by GitHub
52 changed files with 152 additions and 82 deletions

2
go.mod
View File

@@ -17,7 +17,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-oidc/v3 v3.11.0
github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1
github.com/cs3org/reva/v2 v2.26.6-0.20241114152615-4ce61d4d09fc
github.com/cs3org/reva/v2 v2.26.6-0.20241119075849-6f05da66906b
github.com/davidbyttow/govips/v2 v2.15.0
github.com/dhowden/tag v0.0.0-20240417053706-3d75831295e8
github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e

4
go.sum
View File

@@ -255,8 +255,8 @@ github.com/crewjam/saml v0.4.14 h1:g9FBNx62osKusnFzs3QTN5L9CVA/Egfgm+stJShzw/c=
github.com/crewjam/saml v0.4.14/go.mod h1:UVSZCf18jJkk6GpWNVqcyQJMD5HsRugBPf4I1nl2mME=
github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1 h1:RU6LT6mkD16xZs011+8foU7T3LrPvTTSWeTQ9OgfhkA=
github.com/cs3org/go-cs3apis v0.0.0-20241105092511-3ad35d174fc1/go.mod h1:DedpcqXl193qF/08Y04IO0PpxyyMu8+GrkD6kWK2MEQ=
github.com/cs3org/reva/v2 v2.26.6-0.20241114152615-4ce61d4d09fc h1:uhBs3S2G8SpVd38uDzEWazIvR0U3GqL7VfevtkBequ4=
github.com/cs3org/reva/v2 v2.26.6-0.20241114152615-4ce61d4d09fc/go.mod h1:KP0Zomt3dNIr/kU2M1mXzTIVFOtxBVS4qmBDMRCfrOQ=
github.com/cs3org/reva/v2 v2.26.6-0.20241119075849-6f05da66906b h1:RrfFOwT3gZCqlzulV1tq/xfdVG/wvtfe0ChbPJoviv8=
github.com/cs3org/reva/v2 v2.26.6-0.20241119075849-6f05da66906b/go.mod h1:KP0Zomt3dNIr/kU2M1mXzTIVFOtxBVS4qmBDMRCfrOQ=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=

View File

@@ -104,7 +104,7 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
os.Exit(1)
}
drivers := revaconfig.StorageProviderDrivers(cfg)
fs, err := f(drivers[cfg.Driver].(map[string]interface{}), nil)
fs, err := f(drivers[cfg.Driver].(map[string]interface{}), nil, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize filesystem driver '%s'\n", cfg.Driver)
return err

View File

@@ -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 {

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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 {

View File

@@ -22,6 +22,9 @@ import (
"fmt"
"net/http"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/events"
"github.com/cs3org/reva/v2/pkg/events/stream"
@@ -30,8 +33,6 @@ import (
"github.com/cs3org/reva/v2/pkg/rhttp/router"
"github.com/cs3org/reva/v2/pkg/storage"
"github.com/cs3org/reva/v2/pkg/storage/fs/registry"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog"
)
func init() {
@@ -98,12 +99,12 @@ 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
}
dataTXs, err := getDataTXs(conf, fs, evstream)
dataTXs, err := getDataTXs(conf, fs, evstream, log)
if err != nil {
return nil, err
}
@@ -118,14 +119,14 @@ 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)
}
func getDataTXs(c *config, fs storage.FS, publisher events.Publisher) (map[string]http.Handler, error) {
func getDataTXs(c *config, fs storage.FS, publisher events.Publisher, log *zerolog.Logger) (map[string]http.Handler, error) {
if c.DataTXs == nil {
c.DataTXs = make(map[string]map[string]interface{})
}
@@ -144,7 +145,7 @@ func getDataTXs(c *config, fs storage.FS, publisher events.Publisher) (map[strin
txs := make(map[string]http.Handler)
for t := range c.DataTXs {
if f, ok := datatxregistry.NewFuncs[t]; ok {
if tx, err := f(c.DataTXs[t], publisher); err == nil {
if tx, err := f(c.DataTXs[t], publisher, log); err == nil {
if handler, err := tx.Handler(fs); err == nil {
txs[t] = handler
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)
}

View File

@@ -19,13 +19,15 @@
package registry
import (
"github.com/rs/zerolog"
"github.com/cs3org/reva/v2/pkg/events"
"github.com/cs3org/reva/v2/pkg/rhttp/datatx"
)
// NewFunc is the function that data transfer implementations
// should register at init time.
type NewFunc func(map[string]interface{}, events.Publisher) (datatx.DataTX, error)
type NewFunc func(map[string]interface{}, events.Publisher, *zerolog.Logger) (datatx.DataTX, error)
// NewFuncs is a map containing all the registered data transfers.
var NewFuncs = map[string]NewFunc{}

View File

@@ -22,11 +22,12 @@ import (
"net/http"
"time"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
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/internal/http/services/owncloud/ocdav/net"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
@@ -48,6 +49,7 @@ func init() {
type manager struct {
conf *cache.Config
publisher events.Publisher
log *zerolog.Logger
}
func parseConfig(m map[string]interface{}) (*cache.Config, error) {
@@ -60,22 +62,26 @@ func parseConfig(m map[string]interface{}) (*cache.Config, error) {
}
// New returns a datatx manager implementation that relies on HTTP PUT/GET.
func New(m map[string]interface{}, publisher events.Publisher) (datatx.DataTX, error) {
func New(m map[string]interface{}, publisher events.Publisher, log *zerolog.Logger) (datatx.DataTX, error) {
c, err := parseConfig(m)
if err != nil {
return nil, err
}
l := log.With().Str("datatx", "simple").Logger()
return &manager{
conf: c,
publisher: publisher,
log: &l,
}, nil
}
func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sublog := m.log.With().Str("path", r.URL.Path).Logger()
r = r.WithContext(appctx.WithLogger(r.Context(), &sublog))
ctx := r.Context()
sublog := appctx.GetLogger(ctx).With().Str("datatx", "simple").Logger()
switch r.Method {
case "GET", "HEAD":

View File

@@ -26,6 +26,10 @@ import (
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
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/internal/http/services/owncloud/ocdav/net"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
@@ -39,8 +43,6 @@ import (
"github.com/cs3org/reva/v2/pkg/storage/cache"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
)
func init() {
@@ -50,6 +52,7 @@ func init() {
type manager struct {
conf *cache.Config
publisher events.Publisher
log *zerolog.Logger
}
func parseConfig(m map[string]interface{}) (*cache.Config, error) {
@@ -62,25 +65,29 @@ func parseConfig(m map[string]interface{}) (*cache.Config, error) {
}
// New returns a datatx manager implementation that relies on HTTP PUT/GET.
func New(m map[string]interface{}, publisher events.Publisher) (datatx.DataTX, error) {
func New(m map[string]interface{}, publisher events.Publisher, log *zerolog.Logger) (datatx.DataTX, error) {
c, err := parseConfig(m)
if err != nil {
return nil, err
}
l := log.With().Str("datatx", "spaces").Logger()
return &manager{
conf: c,
publisher: publisher,
log: &l,
}, nil
}
func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
var spaceID string
spaceID, r.URL.Path = router.ShiftPath(r.URL.Path)
sublog := appctx.GetLogger(ctx).With().Str("datatx", "spaces").Str("spaceid", spaceID).Logger()
sublog := m.log.With().Str("spaceid", spaceID).Str("path", r.URL.Path).Logger()
r = r.WithContext(appctx.WithLogger(r.Context(), &sublog))
ctx := r.Context()
switch r.Method {
case "GET", "HEAD":

View File

@@ -24,11 +24,13 @@ import (
"path"
"regexp"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/rs/zerolog"
tusd "github.com/tus/tusd/v2/pkg/handler"
"golang.org/x/exp/slog"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/net"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/errtypes"
@@ -38,8 +40,6 @@ import (
"github.com/cs3org/reva/v2/pkg/rhttp/datatx/metrics"
"github.com/cs3org/reva/v2/pkg/storage"
"github.com/cs3org/reva/v2/pkg/storagespace"
"github.com/mitchellh/mapstructure"
"golang.org/x/exp/slog"
)
func init() {
@@ -59,6 +59,7 @@ type TusConfig struct {
type manager struct {
conf *TusConfig
publisher events.Publisher
log *zerolog.Logger
}
func parseConfig(m map[string]interface{}) (*TusConfig, error) {
@@ -71,14 +72,18 @@ func parseConfig(m map[string]interface{}) (*TusConfig, error) {
}
// New returns a datatx manager implementation that relies on HTTP PUT/GET.
func New(m map[string]interface{}, publisher events.Publisher) (datatx.DataTX, error) {
func New(m map[string]interface{}, publisher events.Publisher, log *zerolog.Logger) (datatx.DataTX, error) {
c, err := parseConfig(m)
if err != nil {
return nil, err
}
l := log.With().Str("datatx", "tus").Logger()
return &manager{
conf: c,
publisher: publisher,
log: &l,
}, nil
}
@@ -100,7 +105,7 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
config := tusd.Config{
StoreComposer: composer,
NotifyCompleteUploads: true,
Logger: slog.New(tusdLogger{log: appctx.GetLogger(context.Background())}), // Note: this is a noop logger
Logger: slog.New(tusdLogger{log: m.log}),
}
if m.conf.CorsEnabled {
@@ -154,6 +159,8 @@ func (m *manager) Handler(fs storage.FS) (http.Handler, error) {
}
h := handler.Middleware(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sublog := m.log.With().Str("uploadid", r.URL.Path).Logger()
r = r.WithContext(appctx.WithLogger(r.Context(), &sublog))
method := r.Method
// https://github.com/tus/tus-resumable-upload-protocol/blob/master/protocol.md#x-http-method-override
if r.Header.Get("X-HTTP-Method-Override") != "" {
@@ -251,8 +258,16 @@ func (l tusdLogger) Handle(_ context.Context, r slog.Record) error {
// Enabled returns true
func (l tusdLogger) Enabled(_ context.Context, _ slog.Level) bool { return true }
// WithAttrs is not implemented
func (l tusdLogger) WithAttrs(_ []slog.Attr) slog.Handler { return l }
// WithAttrs creates a new logger with the given attributes
func (l tusdLogger) WithAttrs(attr []slog.Attr) slog.Handler {
fields := make(map[string]interface{}, len(attr))
for _, a := range attr {
fields[a.Key] = a.Value
}
c := l.log.With().Fields(fields).Logger()
sLog := tusdLogger{log: &c}
return sLog
}
// WithGroup is not implemented
func (l tusdLogger) WithGroup(_ string) slog.Handler { return l }
func (l tusdLogger) WithGroup(name string) slog.Handler { return l }

View File

@@ -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")

View File

@@ -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")
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
}

View File

@@ -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,

View File

@@ -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{}

View File

@@ -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

View File

@@ -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

2
vendor/modules.txt vendored
View File

@@ -367,7 +367,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1
github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1
github.com/cs3org/go-cs3apis/cs3/tx/v1beta1
github.com/cs3org/go-cs3apis/cs3/types/v1beta1
# github.com/cs3org/reva/v2 v2.26.6-0.20241114152615-4ce61d4d09fc
# github.com/cs3org/reva/v2 v2.26.6-0.20241119075849-6f05da66906b
## explicit; go 1.22.0
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime