Bump reva to pull in the latest fixes and improvements

This commit is contained in:
André Duffeck
2026-01-21 08:43:08 +01:00
parent ef3c0da0cb
commit a93769ae9b
88 changed files with 7473 additions and 577 deletions
+44 -10
View File
@@ -30,6 +30,7 @@ import (
user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/google/uuid"
lru "github.com/hashicorp/golang-lru/v2"
"github.com/opencloud-eu/reva/v2/pkg/appctx"
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
"github.com/opencloud-eu/reva/v2/pkg/storage/fs/posix/options"
@@ -74,6 +75,7 @@ type Lookup struct {
IDCache IDCache
IDHistoryCache IDCache
spaceRootCache *lru.Cache[string, string]
metadataBackend metadata.Backend
userMapper usermapper.Mapper
tm node.TimeManager
@@ -85,11 +87,14 @@ func New(b metadata.Backend, um usermapper.Mapper, o *options.Options, tm node.T
idHistoryConf.Database = o.Options.IDCache.Table + "_history"
idHistoryConf.TTL = 1 * time.Minute
spaceRootCache, _ := lru.New[string, string](1000)
lu := &Lookup{
Options: o,
metadataBackend: b,
IDCache: NewStoreIDCache(o.Options.IDCache),
IDHistoryCache: NewStoreIDCache(idHistoryConf),
spaceRootCache: spaceRootCache,
userMapper: um,
tm: tm,
}
@@ -99,11 +104,17 @@ func New(b metadata.Backend, um usermapper.Mapper, o *options.Options, tm node.T
// CacheID caches the path for the given space and node id
func (lu *Lookup) CacheID(ctx context.Context, spaceID, nodeID, val string) error {
if spaceID == nodeID {
lu.spaceRootCache.Add(spaceID, val)
}
return lu.IDCache.Set(ctx, spaceID, nodeID, val)
}
// GetCachedID returns the cached path for the given space and node id
func (lu *Lookup) GetCachedID(ctx context.Context, spaceID, nodeID string) (string, bool) {
if spaceID == nodeID {
return lu.getSpaceRootPathWithStatus(ctx, spaceID)
}
return lu.IDCache.Get(ctx, spaceID, nodeID)
}
@@ -186,7 +197,7 @@ func (lu *Lookup) NodeFromID(ctx context.Context, id *provider.ResourceId) (n *n
// The Resource references the root of a space
return lu.NodeFromSpaceID(ctx, id.SpaceId)
}
return node.ReadNode(ctx, lu, id.SpaceId, id.OpaqueId, false, nil, false)
return node.ReadNode(ctx, lu, id.SpaceId, id.OpaqueId, "", false, nil, false)
}
// Pathify segments the beginning of a string into depth segments of width length
@@ -207,7 +218,7 @@ func Pathify(id string, depth, width int) string {
// NodeFromSpaceID converts a resource id into a Node
func (lu *Lookup) NodeFromSpaceID(ctx context.Context, spaceID string) (n *node.Node, err error) {
node, err := node.ReadNode(ctx, lu, spaceID, spaceID, false, nil, false)
node, err := node.ReadNode(ctx, lu, spaceID, spaceID, "", false, nil, false)
if err != nil {
return nil, err
}
@@ -283,35 +294,55 @@ func (lu *Lookup) InternalRoot() string {
return lu.Options.Root
}
func (lu *Lookup) getSpaceRootPathWithStatus(ctx context.Context, spaceID string) (string, bool) {
if val, ok := lu.spaceRootCache.Get(spaceID); ok {
return val, true
}
val, ok := lu.IDCache.Get(ctx, spaceID, spaceID)
if ok {
lu.spaceRootCache.Add(spaceID, val)
}
return val, ok
}
func (lu *Lookup) getSpaceRootPath(ctx context.Context, spaceID string) string {
val, _ := lu.getSpaceRootPathWithStatus(ctx, spaceID)
return val
}
// InternalSpaceRoot returns the internal path for a space
func (lu *Lookup) InternalSpaceRoot(spaceID string) string {
return lu.InternalPath(spaceID, spaceID)
return lu.getSpaceRootPath(context.Background(), spaceID)
}
// InternalPath returns the internal path for a given ID
func (lu *Lookup) InternalPath(spaceID, nodeID string) string {
if strings.Contains(nodeID, node.RevisionIDDelimiter) || strings.HasSuffix(nodeID, node.CurrentIDDelimiter) {
spaceRoot, _ := lu.IDCache.Get(context.Background(), spaceID, spaceID)
spaceRoot := lu.getSpaceRootPath(context.Background(), spaceID)
if len(spaceRoot) == 0 {
return ""
}
return filepath.Join(spaceRoot, MetadataDir, Pathify(nodeID, 4, 2))
}
if spaceID == nodeID {
return lu.getSpaceRootPath(context.Background(), spaceID)
}
path, _ := lu.IDCache.Get(context.Background(), spaceID, nodeID)
return path
}
// LockfilePaths returns the paths(s) to the lockfile of the node
func (lu *Lookup) LockfilePaths(spaceID, nodeID string) []string {
spaceRoot, _ := lu.IDCache.Get(context.Background(), spaceID, spaceID)
func (lu *Lookup) LockfilePaths(n *node.Node) []string {
spaceRoot := lu.getSpaceRootPath(context.Background(), n.SpaceID)
if len(spaceRoot) == 0 {
return nil
}
paths := []string{filepath.Join(spaceRoot, MetadataDir, Pathify(nodeID, 4, 2)+".lock")}
paths := []string{filepath.Join(spaceRoot, MetadataDir, Pathify(n.ID, 4, 2)+".lock")}
nodepath := lu.InternalPath(spaceID, nodeID)
nodepath := n.InternalPath()
if len(nodepath) > 0 {
paths = append(paths, nodepath+".lock")
}
@@ -321,7 +352,7 @@ func (lu *Lookup) LockfilePaths(spaceID, nodeID string) []string {
// VersionPath returns the path to the version of the node
func (lu *Lookup) VersionPath(spaceID, nodeID, version string) string {
spaceRoot, _ := lu.IDCache.Get(context.Background(), spaceID, spaceID)
spaceRoot := lu.getSpaceRootPath(context.Background(), spaceID)
if len(spaceRoot) == 0 {
return ""
}
@@ -331,7 +362,7 @@ func (lu *Lookup) VersionPath(spaceID, nodeID, version string) string {
// VersionPath returns the "current" path of the node
func (lu *Lookup) CurrentPath(spaceID, nodeID string) string {
spaceRoot, _ := lu.IDCache.Get(context.Background(), spaceID, spaceID)
spaceRoot := lu.getSpaceRootPath(context.Background(), spaceID)
if len(spaceRoot) == 0 {
return ""
}
@@ -446,6 +477,9 @@ func (lu *Lookup) PurgeNode(n *node.Node) error {
if cerr := lu.IDCache.Delete(context.Background(), n.SpaceID, n.ID); cerr != nil {
return cerr
}
if n.ID == n.SpaceID {
lu.spaceRootCache.Remove(n.SpaceID)
}
return rerr
}
@@ -360,7 +360,7 @@ func (t *Tree) getNodeForPath(path string) (*node.Node, error) {
return nil, err
}
return node.ReadNode(context.Background(), t.lookup, spaceID, nodeID, false, nil, false)
return node.ReadNode(context.Background(), t.lookup, spaceID, nodeID, path, false, nil, false)
}
func (t *Tree) findSpaceId(path string) (string, error) {
@@ -909,17 +909,24 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
}
if id != "" {
// Check if the item on the previous still exists. In this case it might have been a copy with extended attributes -> set new ID
// Check if the item on the previous path still exists. In this case it might have been a copy with extended attributes -> set new ID
isCopy := false
previousPath, ok := t.lookup.GetCachedID(context.Background(), spaceID, id)
if ok && previousPath != path {
// this id clashes with an existing id -> re-assimilate
_, err := os.Stat(previousPath)
if err == nil {
_ = t.assimilate(scanItem{Path: path})
// previous path (using the same id) still exists -> this is a copy
isCopy = true
}
}
if err := t.lookup.CacheID(context.Background(), spaceID, id, path); err != nil {
t.log.Error().Err(err).Str("spaceID", spaceID).Str("id", id).Str("path", path).Msg("could not cache id")
if isCopy {
// copy detected -> re-assimilate
_ = t.assimilate(scanItem{Path: path})
} else {
// update cached id with new path
if err := t.lookup.CacheID(context.Background(), spaceID, id, path); err != nil {
t.log.Error().Err(err).Str("spaceID", spaceID).Str("id", id).Str("path", path).Msg("could not cache id")
}
}
}
} else if assimilate {
@@ -943,7 +950,7 @@ func (t *Tree) WarmupIDCache(root string, assimilate, onlyDirty bool) error {
t.log.Error().Err(err).Str("path", dir).Msg("could not get ids for path")
continue
}
n, err := node.ReadNode(context.Background(), t.lookup, spaceID, id, true, nil, false)
n, err := node.ReadNode(context.Background(), t.lookup, spaceID, id, dir, true, nil, false)
if err != nil {
t.log.Error().Err(err).Str("path", dir).Msg("could not read directory node")
continue
@@ -216,7 +216,7 @@ func (tp *Tree) DownloadRevision(ctx context.Context, ref *provider.Reference, r
spaceID := ref.ResourceId.SpaceId
// check if the node is available and has not been deleted
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], false, nil, false)
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], "", false, nil, false)
if err != nil {
return nil, nil, err
}
+1 -1
View File
@@ -529,7 +529,7 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
}
}
child, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, false, n.SpaceRoot, true)
child, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, path, false, n.SpaceRoot, true)
if err != nil {
t.log.Error().Err(err).Str("path", path).Msg("failed to read node")
continue
@@ -28,7 +28,6 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/appctx"
ctxpkg "github.com/opencloud-eu/reva/v2/pkg/ctx"
"github.com/opencloud-eu/reva/v2/pkg/errtypes"
"github.com/opencloud-eu/reva/v2/pkg/sharedconf"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/metadata/prefixes"
"github.com/opencloud-eu/reva/v2/pkg/storage/pkg/decomposedfs/node"
@@ -119,7 +118,7 @@ func (fs *Decomposedfs) AddGrant(ctx context.Context, ref *provider.Reference, g
}
}
if sharedconf.MultiTenantEnabled() {
if fs.o.MultiTenantEnabled {
spaceTenant, err := grantNode.SpaceRoot.XattrString(ctx, prefixes.SpaceTenantIDAttr)
if err != nil {
log.Error().Err(err).Msg("failed to read tenant id of space")
@@ -151,7 +151,7 @@ func (lu *Lookup) NodeFromID(ctx context.Context, id *provider.ResourceId) (n *n
// The Resource references the root of a space
return lu.NodeFromSpaceID(ctx, id.SpaceId)
}
return node.ReadNode(ctx, lu, id.SpaceId, id.OpaqueId, false, nil, false)
return node.ReadNode(ctx, lu, id.SpaceId, id.OpaqueId, "", false, nil, false)
}
// Pathify segments the beginning of a string into depth segments of width length
@@ -172,7 +172,7 @@ func Pathify(id string, depth, width int) string {
// NodeFromSpaceID converts a resource id into a Node
func (lu *Lookup) NodeFromSpaceID(ctx context.Context, spaceID string) (n *node.Node, err error) {
node, err := node.ReadNode(ctx, lu, spaceID, spaceID, false, nil, false)
node, err := node.ReadNode(ctx, lu, spaceID, spaceID, "", false, nil, false)
if err != nil {
return nil, err
}
@@ -274,8 +274,8 @@ func (lu *Lookup) InternalPath(spaceID, nodeID string) string {
}
// LockfilePaths returns the paths(s) to the lockfile of the node
func (lu *Lookup) LockfilePaths(spaceID, nodeID string) []string {
return []string{lu.InternalPath(spaceID, nodeID) + ".lock"}
func (lu *Lookup) LockfilePaths(n *node.Node) []string {
return []string{n.InternalPath() + ".lock"}
}
// VersionPath returns the internal path for a version of a node
@@ -29,6 +29,7 @@ import (
"hash/adler32"
"io"
"os"
"path/filepath"
"strconv"
"strings"
"time"
@@ -158,7 +159,7 @@ type PathLookup interface {
InternalRoot() string
InternalSpaceRoot(spaceID string) string
InternalPath(spaceID, nodeID string) string
LockfilePaths(spaceID, nodeID string) []string
LockfilePaths(n *Node) []string
VersionPath(spaceID, nodeID, version string) string
Path(ctx context.Context, n *Node, hasPermission PermissionFunc) (path string, err error)
MetadataBackend() metadata.Backend
@@ -350,7 +351,7 @@ func (n *Node) SpaceOwnerOrManager(ctx context.Context) *userpb.UserId {
}
// ReadNode creates a new instance from an id and checks if it exists
func ReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID string, canListDisabledSpace bool, spaceRoot *Node, skipParentCheck bool) (*Node, error) {
func ReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID, internalPath string, canListDisabledSpace bool, spaceRoot *Node, skipParentCheck bool) (*Node, error) {
ctx, span := tracer.Start(ctx, "ReadNode")
defer span.End()
var err error
@@ -417,6 +418,9 @@ func ReadNode(ctx context.Context, lu PathLookup, spaceID, nodeID string, canLis
},
SpaceRoot: spaceRoot,
}
if internalPath != "" {
n.internalPath = internalPath
}
// append back revision to nodeid, even when returning a not existing node
defer func() {
@@ -506,7 +510,7 @@ func (n *Node) Child(ctx context.Context, name string) (*Node, error) {
return nil, err
}
readNode, err := ReadNode(ctx, n.lu, spaceID, nodeID, false, n.SpaceRoot, true)
readNode, err := ReadNode(ctx, n.lu, spaceID, nodeID, filepath.Join(n.internalPath, name), false, n.SpaceRoot, true)
if err != nil {
return nil, errors.Wrap(err, "could not read child node")
}
@@ -653,7 +657,7 @@ func (n *Node) ParentPath() string {
// path to use for new locks.
// In the future only one path should remain at which point the function can return a single string.
func (n *Node) LockFilePaths() []string {
return n.lu.LockfilePaths(n.SpaceID, n.ID)
return n.lu.LockfilePaths(n)
}
// CalculateEtag returns a hash of fileid + tmtime (or mtime)
@@ -94,6 +94,8 @@ type Options struct {
DisableVersioning bool `mapstructure:"disable_versioning"`
MountID string `mapstructure:"mount_id"`
MultiTenantEnabled bool `mapstructure:"multi_tenant_enabled"`
}
// AsyncPropagatorOptions holds the configuration for the async propagator
@@ -69,7 +69,7 @@ func (fs *Decomposedfs) RestoreRevision(ctx context.Context, ref *provider.Refer
spaceID := ref.ResourceId.SpaceId
// check if the node is available and has not been deleted
n, err := node.ReadNode(ctx, fs.lu, spaceID, kp[0], false, nil, false)
n, err := node.ReadNode(ctx, fs.lu, spaceID, kp[0], "", false, nil, false)
if err != nil {
return err
}
@@ -185,7 +185,7 @@ func (fs *Decomposedfs) getRevisionNode(ctx context.Context, ref *provider.Refer
spaceID := ref.ResourceId.SpaceId
// check if the node is available and has not been deleted
n, err := node.ReadNode(ctx, fs.lu, spaceID, kp[0], false, nil, false)
n, err := node.ReadNode(ctx, fs.lu, spaceID, kp[0], "", false, nil, false)
if err != nil {
return nil, err
}
@@ -107,7 +107,7 @@ func (fs *Decomposedfs) CreateStorageSpace(ctx context.Context, req *provider.Cr
alias = templates.WithSpacePropertiesAndUser(u, req.Type, req.Name, spaceID, fs.o.PersonalSpaceAliasTemplate)
}
root, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, true, nil, false) // will fall into `Exists` case below
root, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, "", true, nil, false) // will fall into `Exists` case below
switch {
case err != nil:
return nil, err
@@ -312,7 +312,7 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
if spaceID != spaceIDAny && entry != spaceIDAny {
// try directly reading the node
n, err := node.ReadNode(ctx, fs.lu, spaceID, entry, true, nil, false) // permission to read disabled space is checked later
n, err := node.ReadNode(ctx, fs.lu, spaceID, entry, "", true, nil, false) // permission to read disabled space is checked later
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Str("id", entry).Msg("could not read node")
return nil, err
@@ -449,7 +449,7 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
continue
}
n, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, true, nil, true)
n, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, "", true, nil, true)
if err != nil {
appctx.GetLogger(ctx).Error().Err(err).Str("id", spaceID).Msg("could not read node, skipping")
continue
@@ -519,7 +519,7 @@ func (fs *Decomposedfs) ListStorageSpaces(ctx context.Context, filter []*provide
// if there are no matches (or they happened to be spaces for the owner) and the node is a child return a space
if int64(len(matches)) <= numShares.Load() && entry != spaceID {
// try node id
n, err := node.ReadNode(ctx, fs.lu, spaceID, entry, true, nil, false) // permission to read disabled space is checked in storageSpaceFromNode
n, err := node.ReadNode(ctx, fs.lu, spaceID, entry, "", true, nil, false) // permission to read disabled space is checked in storageSpaceFromNode
if err != nil {
return nil, err
}
@@ -631,7 +631,7 @@ func (fs *Decomposedfs) UpdateStorageSpace(ctx context.Context, req *provider.Up
}
// check which permissions are needed
spaceNode, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, true, nil, false)
spaceNode, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, "", true, nil, false)
if err != nil {
return nil, err
}
@@ -733,7 +733,7 @@ func (fs *Decomposedfs) DeleteStorageSpace(ctx context.Context, req *provider.De
return err
}
n, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, true, nil, false) // permission to read disabled space is checked later
n, err := node.ReadNode(ctx, fs.lu, spaceID, spaceID, "", true, nil, false) // permission to read disabled space is checked later
if err != nil {
return err
}
@@ -295,7 +295,7 @@ func (p AsyncPropagator) propagate(ctx context.Context, pn PropagationNode, reca
defer func() { _ = unlock() }()
_, subspan = tracer.Start(ctx, "node.ReadNode")
n, err := node.ReadNode(ctx, p.lookup, pn.GetSpaceID(), pn.GetID(), false, nil, false)
n, err := node.ReadNode(ctx, p.lookup, pn.GetSpaceID(), pn.GetID(), "", false, nil, false)
if err != nil {
log.Error().Err(err).
Msg("Propagation failed. Could not read node.")
@@ -214,7 +214,7 @@ func (tp *Tree) DownloadRevision(ctx context.Context, ref *provider.Reference, r
spaceID := ref.ResourceId.SpaceId
// check if the node is available and has not been deleted
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], false, nil, false)
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], "", false, nil, false)
if err != nil {
return nil, nil, err
}
@@ -307,7 +307,7 @@ func (tp *Tree) getRevisionNode(ctx context.Context, ref *provider.Reference, re
spaceID := ref.ResourceId.SpaceId
// check if the node is available and has not been deleted
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], false, nil, false)
n, err := node.ReadNode(ctx, tp.lookup, spaceID, kp[0], "", false, nil, false)
if err != nil {
return nil, err
}
@@ -383,7 +383,7 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
}
}
child, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, false, n.SpaceRoot, true)
child, err := node.ReadNode(ctx, t.lookup, n.SpaceID, nodeID, "", false, n.SpaceRoot, true)
if err != nil {
return err
}
@@ -889,7 +889,7 @@ func (t *Tree) readRecycleItem(ctx context.Context, spaceID, key, path string) (
nodeID = strings.ReplaceAll(nodeID, "/", "")
recycleNode = node.New(spaceID, nodeID, "", "", 0, "", provider.ResourceType_RESOURCE_TYPE_INVALID, nil, t.lookup)
recycleNode.SpaceRoot, err = node.ReadNode(ctx, t.lookup, spaceID, spaceID, false, nil, false)
recycleNode.SpaceRoot, err = node.ReadNode(ctx, t.lookup, spaceID, spaceID, "", false, nil, false)
if err != nil {
return
}
@@ -170,7 +170,7 @@ func (session *DecomposedFsSession) HeaderIfUnmodifiedSince() string {
// Node returns the node for the session
func (session *DecomposedFsSession) Node(ctx context.Context) (*node.Node, error) {
return node.ReadNode(ctx, session.store.lu, session.SpaceID(), session.info.Storage["NodeId"], false, nil, true)
return node.ReadNode(ctx, session.store.lu, session.SpaceID(), session.info.Storage["NodeId"], "", false, nil, true)
}
// ID returns the upload session id
@@ -213,7 +213,7 @@ func (store DecomposedFsStore) CreateNodeForUpload(ctx context.Context, session
store.lu,
)
var err error
n.SpaceRoot, err = node.ReadNode(ctx, store.lu, session.SpaceID(), session.SpaceID(), false, nil, false)
n.SpaceRoot, err = node.ReadNode(ctx, store.lu, session.SpaceID(), session.SpaceID(), "", false, nil, false)
if err != nil {
return nil, err
}
@@ -316,7 +316,7 @@ func (store DecomposedFsStore) updateExistingNode(ctx context.Context, session *
return f.Close()
}
old, _ := node.ReadNode(ctx, store.lu, spaceID, n.ID, false, nil, false)
old, _ := node.ReadNode(ctx, store.lu, spaceID, n.ID, "", false, nil, false)
if _, err := node.CheckQuota(ctx, n.SpaceRoot, true, uint64(old.Blobsize), fsize); err != nil {
return unlock, err
}
@@ -326,7 +326,7 @@ func (session *DecomposedFsSession) Finalize(ctx context.Context) (err error) {
if !isProcessing || procssingID != session.ID() {
versionID := revisionNode.ID + node.RevisionIDDelimiter + session.MTime().UTC().Format(time.RFC3339Nano)
// There should be a revision node (created by the other upload that finished before us), read it and upload our blob there.
existingRevisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, false, spaceRoot, false)
existingRevisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, "", false, spaceRoot, false)
if err != nil || !existingRevisionNode.Exists {
// The revision node has not been created. Likely because the file on disk was modified externally and re-assilimated (watchfs == true)
// Let's create the revision node now and upload the blob to it.
@@ -379,7 +379,7 @@ func (session *DecomposedFsSession) createRevisionNodeForUpload(ctx context.Cont
prefixes.ChecksumPrefix + "md5": md5h.Sum(nil),
prefixes.ChecksumPrefix + "adler32": adler32h.Sum(nil),
}
revisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, false, baseNode.SpaceRoot, false)
revisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, "", false, baseNode.SpaceRoot, false)
if err == nil {
mtime := session.MTime()
attrs.SetString(prefixes.BlobIDAttr, session.ID())
@@ -432,7 +432,7 @@ func (session *DecomposedFsSession) Cleanup(revertNodeMetadata, cleanBin, cleanI
if session.NodeExists() && session.info.MetaData["versionID"] != "" {
versionID := session.info.MetaData["versionID"]
sublog.Debug().Str("nodepath", n.InternalPath()).Str("versionID", versionID).Msg("restoring revision")
revisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, false, n.SpaceRoot, false)
revisionNode, err := node.ReadNode(ctx, session.store.lu, session.SpaceID(), versionID, "", false, n.SpaceRoot, false)
if err != nil {
sublog.Error().Err(err).Str("versionID", versionID).Msg("reading revision node failed")
}
+7 -5
View File
@@ -78,13 +78,15 @@ func (r *revaWalker) walkRecursively(ctx context.Context, wd string, info *provi
return fn(wd, info, nil)
}
list, err := r.readDir(ctx, info.Id)
errFn := fn(wd, info, err)
if err != nil || errFn != nil {
return errFn
err := fn(wd, info, nil)
if err != nil {
return err
}
list, err := r.readDir(ctx, info.Id)
if err != nil {
return err
}
for _, file := range list {
err = r.walkRecursively(ctx, filepath.Join(wd, info.Path), file, fn)
if err != nil && (file.Type != provider.ResourceType_RESOURCE_TYPE_CONTAINER || err != filepath.SkipDir) {