Bump reva
This commit is contained in:
committed by
Ralf Haferkamp
parent
17267e899e
commit
2344092b81
+1
@@ -34,6 +34,7 @@ import (
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/nextcloud"
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/ocis"
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/owncloudsql"
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix"
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/s3"
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/s3ng"
|
||||
// Add your own here
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
// Copyright 2018-2024 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// In applying this license, CERN does not waive the privileges and immunities
|
||||
// granted to it by virtue of its status as an Intergovernmental Organization
|
||||
// or submit itself to any jurisdiction.
|
||||
|
||||
package loader
|
||||
|
||||
import (
|
||||
// Load core storage filesystem backends.
|
||||
_ "github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix"
|
||||
// Add your own here
|
||||
)
|
||||
+9
-4
@@ -1,6 +1,3 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
// Copyright 2018-2021 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -73,7 +70,15 @@ func New(m map[string]interface{}, stream events.Stream, log *zerolog.Logger) (s
|
||||
}
|
||||
|
||||
fs := &posixFS{}
|
||||
um := usermapper.NewUnixMapper()
|
||||
var um usermapper.Mapper
|
||||
if o.UseSpaceGroups {
|
||||
um, err = usermapper.NewUnixMapper()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
um = &usermapper.NullMapper{}
|
||||
}
|
||||
|
||||
var lu *lookup.Lookup
|
||||
switch o.MetadataBackend {
|
||||
|
||||
Generated
Vendored
+4
-2
@@ -1,3 +1,5 @@
|
||||
//go:build linux
|
||||
|
||||
// Copyright 2018-2024 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -30,11 +32,11 @@ type InotifyWatcher struct {
|
||||
log *zerolog.Logger
|
||||
}
|
||||
|
||||
func NewInotifyWatcher(tree *Tree, log *zerolog.Logger) *InotifyWatcher {
|
||||
func NewInotifyWatcher(tree *Tree, log *zerolog.Logger) (*InotifyWatcher, error) {
|
||||
return &InotifyWatcher{
|
||||
tree: tree,
|
||||
log: log,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (iw *InotifyWatcher) Watch(path string) {
|
||||
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
//go:build !linux
|
||||
|
||||
// Copyright 2025 OpenCloud GmbH <mail@opencloud.eu>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package tree
|
||||
|
||||
import (
|
||||
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
// NullWatcher is a dummy watcher that does nothing
|
||||
type NullWatcher struct{}
|
||||
|
||||
// Watch does nothing
|
||||
func (*NullWatcher) Watch(path string) {}
|
||||
|
||||
// NewInotifyWatcher returns a new inotify watcher
|
||||
func NewInotifyWatcher(tree *Tree, log *zerolog.Logger) (*NullWatcher, error) {
|
||||
return nil, errtypes.NotSupported("inotify watcher is not supported on this platform")
|
||||
}
|
||||
+26
-23
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"go-micro.dev/v4/store"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
@@ -114,26 +113,29 @@ func New(lu node.PathLookup, bs node.Blobstore, um usermapper.Mapper, trashbin *
|
||||
log: log,
|
||||
}
|
||||
|
||||
watchPath := o.WatchPath
|
||||
var err error
|
||||
switch o.WatchType {
|
||||
case "gpfswatchfolder":
|
||||
t.watcher, err = NewGpfsWatchFolderWatcher(t, strings.Split(o.WatchFolderKafkaBrokers, ","), log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "gpfsfileauditlogging":
|
||||
t.watcher, err = NewGpfsFileAuditLoggingWatcher(t, o.WatchPath, log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
t.watcher = NewInotifyWatcher(t, log)
|
||||
watchPath = o.Root
|
||||
}
|
||||
|
||||
// Start watching for fs events and put them into the queue
|
||||
if o.WatchFS {
|
||||
watchPath := o.WatchPath
|
||||
var err error
|
||||
switch o.WatchType {
|
||||
case "gpfswatchfolder":
|
||||
t.watcher, err = NewGpfsWatchFolderWatcher(t, strings.Split(o.WatchFolderKafkaBrokers, ","), log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
case "gpfsfileauditlogging":
|
||||
t.watcher, err = NewGpfsFileAuditLoggingWatcher(t, o.WatchPath, log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
t.watcher, err = NewInotifyWatcher(t, log)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
watchPath = o.Root
|
||||
}
|
||||
|
||||
go t.watcher.Watch(watchPath)
|
||||
go t.workScanQueue()
|
||||
}
|
||||
@@ -439,7 +441,8 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
|
||||
|
||||
_, nodeID, err := t.lookup.IDsForPath(ctx, path)
|
||||
if err != nil {
|
||||
return err
|
||||
t.log.Error().Err(err).Str("path", path).Msg("failed to get ids for entry")
|
||||
continue
|
||||
}
|
||||
|
||||
child, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, false, n.SpaceRoot, true)
|
||||
@@ -491,7 +494,7 @@ func (t *Tree) Delete(ctx context.Context, n *node.Node) error {
|
||||
// remove entry from cache immediately to avoid inconsistencies
|
||||
defer func() {
|
||||
if err := t.idCache.Delete(path); err != nil {
|
||||
log.Error().Err(err).Str("path", path).Msg("could not delete id from cache")
|
||||
t.log.Error().Err(err).Str("path", path).Msg("could not delete id from cache")
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -513,7 +516,7 @@ func (t *Tree) Delete(ctx context.Context, n *node.Node) error {
|
||||
|
||||
// Remove lock file if it exists
|
||||
if err := os.Remove(n.LockFilePath()); err != nil {
|
||||
log.Error().Err(err).Str("path", n.LockFilePath()).Msg("could not remove lock file")
|
||||
t.log.Error().Err(err).Str("path", n.LockFilePath()).Msg("could not remove lock file")
|
||||
}
|
||||
|
||||
err := t.trashbin.MoveToTrash(ctx, n, path)
|
||||
@@ -634,7 +637,7 @@ func (t *Tree) createDirNode(ctx context.Context, n *node.Node) (err error) {
|
||||
}
|
||||
|
||||
if err := idcache.Set(ctx, n.SpaceID, n.ID, path); err != nil {
|
||||
log.Error().Err(err).Str("spaceID", n.SpaceID).Str("id", n.ID).Str("path", path).Msg("could not cache id")
|
||||
t.log.Error().Err(err).Str("spaceID", n.SpaceID).Str("id", n.ID).Str("path", path).Msg("could not cache id")
|
||||
}
|
||||
|
||||
attributes := n.NodeMetadata(ctx)
|
||||
|
||||
vendor/github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/usermapper/usermapper_default.go
Generated
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
//go:build !linux
|
||||
|
||||
// Copyright 2025 OpenCloud GmbH <mail@opencloud.eu>
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package usermapper
|
||||
|
||||
import "github.com/opencloud-eu/reva/v2/pkg/errtypes"
|
||||
|
||||
// NewUnixMapper returns a new user mapper
|
||||
func NewUnixMapper() (*NullMapper, error) {
|
||||
return &NullMapper{}, errtypes.NotSupported("inotify watcher is not supported on this platform")
|
||||
}
|
||||
Generated
Vendored
+4
-2
@@ -1,3 +1,5 @@
|
||||
//go:build linux
|
||||
|
||||
// Copyright 2018-2021 CERN
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -37,14 +39,14 @@ type UnixMapper struct {
|
||||
}
|
||||
|
||||
// New returns a new user mapper
|
||||
func NewUnixMapper() *UnixMapper {
|
||||
func NewUnixMapper() (*UnixMapper, error) {
|
||||
baseUid, _ := unix.SetfsuidRetUid(-1)
|
||||
baseGid, _ := unix.SetfsgidRetGid(-1)
|
||||
|
||||
return &UnixMapper{
|
||||
baseUid: baseUid,
|
||||
baseGid: baseGid,
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
// RunInUserScope runs the given function in the scope of the base user
|
||||
|
||||
Reference in New Issue
Block a user