bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-07-26 15:58:35 +02:00
parent 1658084812
commit 482e0e7838
10 changed files with 47 additions and 24 deletions
@@ -276,11 +276,23 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
failed = true
}
getParent := func() *node.Node {
p, err := up.Node.Parent(ctx)
if err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not read parent")
return nil
}
return p
}
now := time.Now()
if p, err := node.ReadNode(ctx, fs.lu, up.Info.Storage["SpaceRoot"], n.ParentID, false, nil, true); err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not read parent")
} else {
// update parent tmtime to propagate etag change
if failed {
// propagate sizeDiff after failed postprocessing
if err := fs.tp.Propagate(ctx, up.Node, -up.SizeDiff); err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not propagate tree size change")
}
} else if p := getParent(); p != nil {
// update parent tmtime to propagate etag change after successful postprocessing
_ = p.SetTMTime(ctx, &now)
if err := fs.tp.Propagate(ctx, p, 0); err != nil {
log.Error().Err(err).Str("uploadID", ev.UploadID).Msg("could not propagate etag change")
@@ -900,7 +912,7 @@ func (fs *Decomposedfs) ListFolder(ctx context.Context, ref *provider.Reference,
for child := range work {
np := rp
// add this childs permissions
pset, _ := n.PermissionSet(ctx)
pset, _ := child.PermissionSet(ctx)
node.AddPermissions(&np, &pset)
ri, err := child.AsResourceInfo(ctx, &np, mdKeys, fieldMask, utils.IsRelativeReference(ref))
if err != nil {
@@ -234,7 +234,7 @@ func Get(ctx context.Context, id string, lu *lookup.Lookup, tp Tree, fsRoot stri
up := buildUpload(ctx, info, info.Storage["BinPath"], infoPath, lu, tp, pub, async, tknopts)
up.versionsPath = info.MetaData["versionsPath"]
up.sizeDiff, _ = strconv.ParseInt(info.MetaData["sizeDiff"], 10, 64)
up.SizeDiff, _ = strconv.ParseInt(info.MetaData["sizeDiff"], 10, 64)
return up, nil
}
@@ -364,8 +364,8 @@ func initNewNode(upload *Upload, n *node.Node, fsize uint64) (*lockedfile.File,
}
// on a new file the sizeDiff is the fileSize
upload.sizeDiff = int64(fsize)
upload.Info.MetaData["sizeDiff"] = strconv.Itoa(int(upload.sizeDiff))
upload.SizeDiff = int64(fsize)
upload.Info.MetaData["sizeDiff"] = strconv.Itoa(int(upload.SizeDiff))
return f, nil
}
@@ -393,9 +393,9 @@ func updateExistingNode(upload *Upload, n *node.Node, spaceID string, fsize uint
}
upload.versionsPath = upload.lu.InternalPath(spaceID, n.ID+node.RevisionIDDelimiter+tmtime.UTC().Format(time.RFC3339Nano))
upload.sizeDiff = int64(fsize) - old.Blobsize
upload.SizeDiff = int64(fsize) - old.Blobsize
upload.Info.MetaData["versionsPath"] = upload.versionsPath
upload.Info.MetaData["sizeDiff"] = strconv.Itoa(int(upload.sizeDiff))
upload.Info.MetaData["sizeDiff"] = strconv.Itoa(int(upload.SizeDiff))
targetPath := n.InternalPath()
@@ -91,6 +91,8 @@ type Upload struct {
Info tusd.FileInfo
// node for easy access
Node *node.Node
// SizeDiff size difference between new and old file version
SizeDiff int64
// infoPath is the path to the .info file
infoPath string
// binPath is the path to the binary file (which has no extension)
@@ -100,8 +102,6 @@ type Upload struct {
tp Tree
// versionsPath will be empty if there was no file before
versionsPath string
// sizeDiff size difference between new and old file version
sizeDiff int64
// and a logger as well
log zerolog.Logger
// publisher used to publish events
@@ -296,7 +296,7 @@ func (upload *Upload) FinishUpload(_ context.Context) error {
}
}
return upload.tp.Propagate(upload.Ctx, n, upload.sizeDiff)
return upload.tp.Propagate(upload.Ctx, n, upload.SizeDiff)
}
// Terminate terminates the upload