Skip to content

Commit

Permalink
add IsVersion to UploadReadyEvent
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <jkoberg@owncloud.com>
  • Loading branch information
kobergj committed Sep 16, 2024
1 parent a7bf2bc commit 5371b2b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions changelog/unreleased/add-version-to-urevent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Add IsVersion to UploadReadyEvent

Adds an IsVersion flag indicating that this upload is a version of an existing file

https://github.com/cs3org/reva/pull/4847
3 changes: 2 additions & 1 deletion pkg/events/postprocessing.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,9 @@ type UploadReady struct {
SpaceOwner *user.UserId
ExecutingUser *user.User
FileRef *provider.Reference
Failed bool
Timestamp *types.Timestamp
Failed bool
IsVersion bool
// add reference here? We could use it to inform client pp is finished
}

Expand Down
9 changes: 9 additions & 0 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,14 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {

fs.sessionStore.Cleanup(ctx, session, revertNodeMetadata, keepUpload, unmarkPostprocessing)

var isVersion bool
if session.NodeExists() {
info, err := session.GetInfo(ctx)
if err == nil && info.MetaData["versionsPath"] != "" {
isVersion = true
}
}

if err := events.Publish(
ctx,
fs.stream,
Expand All @@ -365,6 +373,7 @@ func (fs *Decomposedfs) Postprocessing(ch <-chan events.Event) {
},
Timestamp: utils.TimeToTS(now),
SpaceOwner: n.SpaceOwnerOrManager(ctx),
IsVersion: isVersion,
},
); err != nil {
sublog.Error().Err(err).Msg("Failed to publish UploadReady event")
Expand Down

0 comments on commit 5371b2b

Please sign in to comment.